summaryrefslogtreecommitdiff
path: root/apishim
AgeCommit message (Collapse)Author
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-06-01Validate test wifi/eth/bluetooth/mobile networksRemi NGUYEN VAN
While not all test networks created by TestNetworkManager should be validated (because they can be used in self-contained tests that should not see unexpected traffic, such as data usage tests), allowing NetworkMonitor to validate test networks that intend to replicate actual network management on the device is valuable for proper testing. This change considers that a network that has both TRANSPORT_TEST and another major transport type (wifi, ethernet, bluetooth, mobile) is attempting to replicate actual network management on the device: this is currently the case with EthernetManager#setIncludeTestInterfaces. In such cases, have the system perform validation even if the network does not have CAPABILITY_INTERNET. Because TRANSPORT_TEST networks do not have CAPABILITY_INTERNET (as expected from the network agent and enforced by ConnectivityService), they still cannot become default networks, even if they gain CAPABILITY_VALIDATED. Bug: 156319532 Test: atest NetworkStackTests FrameworksNetTests CaptivePortalApiTest Original-Change: https://android-review.googlesource.com/1317682 Merged-In: Ib5810dc3b589ffddc06507fb8be3066e09063a3c Change-Id: Ib5810dc3b589ffddc06507fb8be3066e09063a3c
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-05-18Bump NetworkStack to system_30Remi NGUYEN VAN
NetworkStack can use system_30 now that system_30 exists. This change moves the "current" API shims to api30, and adds an api31 shim. Test: atest NetworkStackTests NetworkStackNextTests, manual (Wifi, telephony working) Bug: 143586229 Change-Id: I37ca0e5a8a5c5620f5fed478648853b668e87f50
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-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-27Add a ShimUtils.isAtLeastR() and use it in tests.Treehugger Robot
Bug: 152723363 Test: atest NetworkStackTests NetworkStackIntegrationTests Test: atest NetworkStackNextTests NetworkStackNextIntegrationTests Original-Change: http://aosp/1295494 Merged-In: I88c33a48a627008f5ad7f880bd09c568866b1c5b Change-Id: I88c33a48a627008f5ad7f880bd09c568866b1c5b
2020-04-25Add a VERSION constant to the NetworkStack shims.Lorenzo Colitti
This is useful for tests, in particular to ensure that tests do not fail when compiled against a version of the shims that does not support the functionality they are testing. Test: m Bug: 152723363 Merged-In: I44fa537d792ccc205e54e3be460a90994a47c52e Change-Id: I44fa537d792ccc205e54e3be460a90994a47c52e
2020-04-15Add shims to get and set the NAT64 prefix in LinkProperties.Treehugger Robot
Bug: 153694684 Test: m NetworkStack NetworkStackNext Merged-In: I934fed7a0a8921d3dce7584b5f1b74a0ad67f14a Change-Id: I934fed7a0a8921d3dce7584b5f1b74a0ad67f14a
2020-03-20Merge "Adjust code for API council feedback" into rvc-devJunyu Lai
2020-03-20Merge "Give netId a getter as requested by the API council." into rvc-devJunyu Lai
2020-03-19Give netId a getter as requested by the API council.Chalard Jean
Bug: 151156820 Test: NetworkStackTests Change-Id: I7de0788e57b2b53bc951d9b41304cc4314c1cb91
2020-03-19Adjust code for API council feedbackChalard Jean
Bug: 151322799 Test: NetworkStackTests Change-Id: Ie0856f6d516096923f5f8b5c7df2965c5f853d08
2020-03-18Move sensitive field parceling bool to constructorAutomerger Merge Worker
This addresses API review comments recommending to use a copy constructor with additional parameters instead of a dedicated method. makeSensitiveFieldsParcelingCopy becomes LinkProperties(base, true). Bug: 150877475 Test: atest FrameworksNetTests NetworkStackTests NetworkStackNextTests Merged-In: I588a40cd32667aba8e11c663833621b1c441a87a (cherry picked from commit a148ea2ac623cc85f23155bfdb35609756d6bdbc) Change-Id: Ibe7c94627c2a6af45b129020808b752207ff82b6
2020-03-16Merge "Address aosp/1199568 leftover comments" into rvc-devPaul Hu
2020-03-11Make IpClient populate the DHCP server address in LinkPropertiesAutomerger Merge Worker
Bug: 134098566 Test: lunch arm_aosp-userdebug make -j32 Change-Id: Ide9610f9b17992eef83e1c42ac71b1b79c179f44 Merged-In: If86a6303671b03bb2ccf98de7e9d77020b013d2f (cherry picked from commit 10d243214ae933d063affdd2b4f6c1f837279586)
2020-03-10Address aosp/1199568 leftover commentsAutomerger Merge Worker
Bug: 139269711 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I6e4f16e70b290ce6a3566b92e5946c65075971a1 Merged-In: I6e4f16e70b290ce6a3566b92e5946c65075971a1 (cherry picked from aosp/1240746)
2020-02-20Merge "Add captive portal info to DhcpClient output"Xiao Ma
2020-02-20Merge "Show notifications after capport login"Chalard Jean
2020-02-19Add captive portal info to DhcpClient outputRemi NGUYEN VAN
Requesting the captive portal option is flagged off by default. The URL it provides will be used to support the captive portal API; see RFC7710bis. Bug: 139269711 Test: atest NetworkStackTests NetworkStackNextTests Test: atest NetworkStackIntegrationTests NetworkStackNextIntegrationTests Change-Id: I783466e0e60f364e79cd76af3fe43a7862d35cf2
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-18Send the capport fields to the system server.Chalard Jean
The fields are behind a protection method to avoid inadvertently sending private data to apps. This is going to the system server which needs those fields. Test: NetworkStackTests Change-Id: I7c9a7a82efa364835164622d2e93977e0bcd3d8c
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 shims for network info classesRemi NGUYEN VAN
Combine shims for LinkProperties and NetworkCapabilities to avoid too many shim classes, and use static methods as the original types (and not the shims) would generally be used to reference the classes. CaptivePortalData is not available in API29 so CaptivePortalDataShim is used as a wrapper that can hold a reference to it in common code. Sample usage in NetworkMonitor: final CaptivePortalDataShim data; try { data = CaptivePortalDataShimImpl.fromJSON(obj); } catch (UnsupportedApiLevelException | JSONException e) { // Do some fallback return; } // Just to give an idea if (data.isCaptive()) { openCaptivePortalApp(data.getUserPortalUrl()); } data.notifyChanged(mCallbacks); Test: atest NetworkStackTests NetworkStackNextTests Bug: 139269711 Change-Id: I262aaa41013ebe1ec4263a6516bd8cab76509304
2020-02-07Fix typo in ConstantsShim constant.Cody Kesting
This change fixes a typo in the value assigned to the constant KEY_NETWORK_PROBES_ATTEMPTED_BITMASK, which is defined in the ConstantsShim for API level 29. This constant is a copy of the constant of the same name defined in ConnectivityDiagnosticsManager (which is also being updated in aosp/1226857). Bug: 148939502 Test: compiles Change-Id: I1f1369ad1034bcde0650bcc0f1fd69f49524a5fc
2020-02-05Include Bundle values with ConnectivityDiagnostics calls.Cody Kesting
ConnectivityDiagnostics allows PersistableBundles to be passed from NetworkMonitor to ConnectivityDiagnosticsCallbacks that are registered with the System in ConnectivityService. This change populates the bundles passed from NetworkMonitor with values relating to ConnectivityDiagnosticsManager#ConnectivityReport and ConnectivityDiagnosticsManager#DataStallReport using keys defined in those classes. The keys used for the bundles are defined in ConstantsShim. Bug: 147249364 Test: compiles Test: atest NetworkStackTests Change-Id: Id007ab38a20c6a107c9528e3e861dafa191797c3 Merged-In: Id007ab38a20c6a107c9528e3e861dafa191797c3
2020-02-05Define callback for suspected data stall.Cody Kesting
Currently, NetworkStack does not notify ConnectivityService explicitly when it detects a potential data stall. This adds a new method notifyDataStallSuspected() to INetworkMonitorCallbacks for notifying ConnectivityService. ConstantsShim is defined for using constants from the Android platform that are introduced after the NetworkStack mainline module was defined. Bug: 143187964 Test: compiles Test: atest NetworkStackTests Change-Id: Ie3b5b4e71e4a4b15a5a84f761eaead3acf6fc807 Merged-In: Ie3b5b4e71e4a4b15a5a84f761eaead3acf6fc807
2019-12-18Revise doc for NetworkShimChiachang Wang
Bug: 130325409 Test: atest NetworkStackTests NetworkStackNextTests Test: m doc-comment-check-docs Change-Id: Ie1813a1304533349bbd27fada94a9aeb223f09e0
2019-12-18Add NetworkShimChiachang Wang
NetId is exposed as system API after API 29. NetworkStack will need netId to get the fwmark information from netd. Because NetworkStack will need at least two different build to support the API usage. Thus, create NetworkShim to support design compatible. Bug: 130325409 Test: atest NetworkStackTests NetworkStackNextTests Change-Id: I1b8fa69b4c0fece95a81e4aa43ef84dc68852237
2019-11-08Revert "Revert "Fix sll_protocol in DhcpClient packet socket""Remi NGUYEN VAN
Fix sll_protocol in DhcpClient packet socket The broadcast socket address was created with a deprecated API that does not set sll_protocol. This causes packets to be filtered incorrectly in packet capture, typically with tcpdump. This change only affects device with API > Q, since Q does not have the proper API to set the protocol. Also includes fixing the build path that was referencing apishim/current (which does not exist) instead of apishim/30 (the correct directory). SocketUtilsShim can be used on the system_current target with that fix. See change: I07887b82e0e32aadb0cbb9f930f2b2fa3e277ca9 Bug: 133196453 Test: manual; on AOSP with the new build, packet capture has the right protocol. When installed on a Q release build, behavior is unchanged. This reverts commit 5ad0944d24e8dabc7fa56c3325e9200669889641. Reason for revert: Roll forward the previous change, as the build breakage has been addressed. The stable build target is now used to build the NetworkStack mainline module, which allows this change to be merged. Change-Id: Ie933050ef269ce2159f3f44ac4db1f9aae134faf
2019-11-06Revert "Fix sll_protocol in DhcpClient packet socket"Remi NGUYEN VAN
This reverts commit 0c5e74000546a6c148e79985ee5fbf53dc454453. Reason for revert: Broke build in qt-qpr1-dev-plus-aosp Change-Id: I2e5738e776881f8c4f3cf459398a250560a43559
2019-11-06Fix sll_protocol in DhcpClient packet socketRemi NGUYEN VAN
The broadcast socket address was created with a deprecated API that does not set sll_protocol. This causes packets to be filtered incorrectly in packet capture, typically with tcpdump. This change only affects device with API > Q, since Q does not have the proper API to set the protocol. Also includes fixing the build path that was referencing apishim/current (which does not exist) instead of apishim/30 (the correct directory). SocketUtilsShim can be used on the system_current target with that fix. See change: I07887b82e0e32aadb0cbb9f930f2b2fa3e277ca9 Bug: 133196453 Test: manual; on AOSP with the new build, packet capture has the right protocol. When installed on a Q release build, behavior is unchanged. Change-Id: Iaafd0b3935473b1cfab61b49b2f107e71e01de2d
2019-10-28Compile NetworkStackApiStable as system_29Remi NGUYEN VAN
Also slightly change the structure of shims so that the compat version uses a different package (com.android.networkstack.apishim.api29), which is jarjared to the main package name on API stable builds. On API current builds, the shim falls back to the compat version if Build.VERSION is older, or uses the main package otherwise. Jarjar requires using a java_library instead of a filegroup, so the shims build targets are converted to java_libraries. This allows the API current build to be usable on older devices, since it will automatically fall back to the compat APIs. When the new SDK is finalized, the API current build can then be shipped without code modification. The code also looks better in IDEs as there are no package conflicts. If there are several versions of the same shim depending on the API level (so different implementations for different methods in SocketUtilsShimImpl depending on the API level), having the shim extend the previous version shim allows to add methods with compatibility behavior without re-implementing the whole class. Test: m NetworkStack NetworkStackApiStable Test: flashed, WiFi working Test: atest NetworkStackTests Change-Id: I86f28912b80b8396d6b9b2acd2e247651ba80289
2019-09-03Add build target for NetworkStack on API 29Remi NGUYEN VAN
NetworkStack will need at least two different build targets: one for the in-progress SDK for testing before release, and one for the latest released SDK for releasing to production. The difference in available APIs is abstracted from the core code by using shims, with one shim for the released SDK that uses fallback code, and one shim for the in-progress SDK that calls the actual new API. The shim included in the built code depends on the build target. AOSP does not yet have prebuilts for API 29, so the build rule still references system_current for now. Test: atest NetworkStackTests Test: flashed, WiFi working Test: aapt dump xmltree NetworkStack.apk AndroidManifest.xml: no change Test: m NetworkStackApiStable (on a branch that has the prebuilt SDK) Change-Id: I9cf8e712b56a8aad8656eb5095ac8a32f4a05037