summaryrefslogtreecommitdiff
path: root/src/com/android/server/NetworkStackService.java
AgeCommit message (Collapse)Author
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-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-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-01-29Add implementation of getInterfaceHash()Paul Trautrim
Exempt-From-Owner-Approval: cherry-pick from internal Bug: 136065010 Test: m Change-Id: Iaf682c850b7cf22980d6fb88d3d60e24c189b74c Merged-In: Iaf682c850b7cf22980d6fb88d3d60e24c189b74c
2019-12-11Add Rapid Commit option support in DHCP Server side.Xiao Ma
Bug:136216415 Test: atest FrameworksNetTests NetworkStackTests Test: atest NetworkStackIntegrationTests Test: manual tethering Change-Id: I0f9483c72374bab271eb18549a1a41812f32f2dd
2019-10-30Remove hidden annotation usage from NetworkStackRemi NGUYEN VAN
NetworkStack uses hidden android.annotation.* annotations by pulling the source files from frameworks/base. This should not be necessary, since androidx annotations can be used instead. Remove usage of such annotations and replace with androidx annotations. Test: m NetworkStack NetworkStackApiStable Test: builds, boots, WiFi working Bug: 139105333 Change-Id: I24e147ac4f01feaf53424430b4825b316ec154fe
2019-09-04Merge "Refactor NetworkStackService for testability"Remi NGUYEN VAN
am: 71116233d8 Change-Id: I840bf9bf849730c7b56c81b97148f3299688843d
2019-09-03Refactor NetworkStackService for testabilityRemi NGUYEN VAN
Refactor some methods to allow integration testing between ConnectivityService and NetworkStack. The integration tests override some NetworkStack methods to mock permission checks or NetworkMonitor network requests. Test: atest NetworkStackTests Change-Id: Ib5b4458f0b4d1423759e1e4016ab961d3ced7b48
2019-06-04Check system_server PID in NetworkStack callsRemi NGUYEN VAN
Add a check that callers with UID 1000 always have the same PID. This is a proxy for checking that no system is designed to bind to the network stack unless it is the system_server, as otherwise either the system_server would start crashing, or that system would not have access to binder calls. Also remove access from PHONE_UID as it is not being used. Test: Flashed, WiFi working, Bluetooth reverse tethering shows no permission issue. Bug: 133209255 (patched automatically from Ib848aaaedfd599c1d4437378846c7dda74352019) (command: git -C [qt repo] show -p 4895c5 | patch -p3) Merged-In: I1205ae4b1062fe78f1e2283d6c308caa58651e86 Change-Id: I42215bd8b14d66d0150e7dac04fbb28feef991a6
2019-05-30Check system_server PID in NetworkStack callsRemi NGUYEN VAN
Add a check that callers with UID 1000 always have the same PID. This is a proxy for checking that no system is designed to bind to the network stack unless it is the system_server, as otherwise either the system_server would start crashing, or that system would not have access to binder calls. Also remove access from PHONE_UID as it is not being used. Test: Flashed, WiFi working, Bluetooth reverse tethering shows no permission issue. Bug: 133209255 Change-Id: Ib848aaaedfd599c1d4437378846c7dda74352019
2019-05-22Address comments on dumpsys network_stack versionRemi NGUYEN VAN
Track a set of versions instead of just the latest seen version, and print versions in the standard dumpsys network_stack as well. Also add version tracking for the netd aidl interface. Test: Flashed, dumpsys network_stack and dumpsys network_stack version Bug: 133124190 Change-Id: I9bf21b10b02f605ef7b85aceb808a5437d936f85
2019-05-21Add dumpsys network_stack versionRemi NGUYEN VAN
This is necessary to allow testing for the network stack version and the version it is getting from the system server. Test: flashed, WiFi working Test: dumpsys network_stack version shows data (although version numbers being fixed) Bug: 133124190 (clean cherry-pick from qt-dev) Change-Id: If5114ee2b02408cf96f86efaec2c420ccc5e330a Merged-In: I9ea85c29667d4510225637071990732360841db6
2019-05-20Add dumpsys network_stack versionRemi NGUYEN VAN
This is necessary to allow testing for the network stack version and the version it is getting from the system server. Test: flashed, WiFi working Test: dumpsys network_stack version shows data (although version numbers being fixed) Bug: 133124190 Change-Id: I9ea85c29667d4510225637071990732360841db6
2019-04-23Freeze the networkstack-aidl-interfaces interfaceLorenzo Colitti
This freezes the interface as of the latest beta build, not the tip of tree. IIpClient#setL2KeyAndGroupHint is not in the frozen definition in particular. Generated with: m networkstack-aidl-interfaces-freeze-api \ ipmemorystore-aidl-interfaces-freeze-api Test: flashed, booted, WiFi and captive portal working Bug: 128803828 Change-Id: Ideabe73fc93bbefca2d624ee9ca190cf31419424 Merged-In: Ideabe73fc93bbefca2d624ee9ca190cf31419424 (cherry picked from commit 9b89cdaaf401a6b77e160807039c06e537fa600a)
2019-04-23Freeze the networkstack-aidl-interfaces interfaceRemi NGUYEN VAN
This freezes the interface as of the latest beta build, not the tip of tree. IIpClient#setL2KeyAndGroupHint is not in the frozen definition in particular. Generated with: m networkstack-aidl-interfaces-freeze-api \ ipmemorystore-aidl-interfaces-freeze-api Test: flashed, booted, WiFi and captive portal working Bug: 128803828 Change-Id: Ideabe73fc93bbefca2d624ee9ca190cf31419424
2019-04-01Cleanup SystemReady in the network stackChalard Jean
The system server (in SystemServer.java) defines the boot sequence, during which an event called SystemReady happens. This corresponds to a time when critical system services that are depended upon by other components in the system server are ready to handle requests from their dependencies. Some system services are listening to this event to defer initializations that depend on the critical services. Because the network stack is only started after SystemReady, there is no way any NetworkMonitor may be started before SystemReady. Remove the associated mechanism. Fix: 129376083 Test: FrameworksNetTests Change-Id: I071eeb10d0b7c4f71af6653d322c7b442b2cc7ee
2019-04-01Fix race when starting NetworkMonitorRemi NGUYEN VAN
NetworkMonitor obtained LinkProperties and NetworkCapabilities via synchronous calls to ConnectivityManager after receiving an asynchronous notification, which is prone to races: the network could be gone before the LinkProperties/NetworkCapabilities can be fetched. Fix the race by passing LinkProperties/NetworkCapabilities directly to NetworkMonitor in the asynchronous notifications. Test: atest FrameworksNetTests NetworkStackTests Test: booted, WiFi works Bug: 129375892 Change-Id: I200ac7ca6ff79590b11c9be705f650c92fd3cb63
2019-03-21Merge "Improve partial connectivity"Lucas Lin
2019-03-20Improve partial connectivitylucaslin
Improve the design and fix some nits. Bug: 113450764 Test: 1. Build pass 2. atest FrameworksNetTests 3. atest NetworkStackTests 4. Change captive_portal_https_url to https://invalid.com to simulate partial connectivity. Change-Id: Ia56645841d00d2ed8406cfeacb86a4a27fd58650
2019-03-18Move the IpMemoryStore to the network stack.Chalard Jean
Test: atest FrameworksNetTests Change-Id: Ic5bd6ff54b09a6fa92b6863f240a5b053011acb6
2019-03-16Remove NetworkParcelableRemi NGUYEN VAN
With the @JavaOnlyStableParcelable annotation, Network can now be used as-is as a framework parcelable. Test: atest FrameworksNetTests NetworkStackTests Bug: 126477266 Change-Id: I5d9695a31b3ac48d10edcf08ccd0c34375353b79
2019-03-12Check if network has partial connectivitylucaslin
In some networks, network validation may only get success result for http probe but fail result for https probe. For this kind of network, it may still work at some websites or apps, but user didn't know about that. In order to fix this issue, we will check if network has partial connectivity and notify user to make a choice if they want to use this partial connectivity or not. Bug: 113450764 Test: 1. Build pass. 2. Fake partial connectivity case for testing. 3. atest FrameworksNetTests 4. atest NetworkStackTests Change-Id: I69ed00ac4850904ff708c9fef22e148879a10e92
2019-02-15Remove NetworkMonitor dependency on ICaptivePortalRemi NGUYEN VAN
ICaptivePortal is used in the framework and cannot be used as a dependency in NetworkMonitor, as the framework class takes precedence when linking. Also fix NetworkMonitorTest that was not verifying the right startCaptivePortalApp call. Test: atest FrameworksNetTests NetworkStackTests Bug: 124033493 Change-Id: I8e7bb79e50650ae182a2e4277fb49abf5fb6d910 Merged-In: Ib6a89e54312628662b130fbeec18d11e139f09fa
2019-02-14Remove deps from framework on netd interfacesRemi NGUYEN VAN
If included in framework.jar, the interfaces conflict with any app that needs to depend on them, including the NetworkStack. Bug: 124033493 Test: atest FrameworksNetTests NetworkStackTests Change-Id: I2db9f87b7154130726d4700b241d55b041635d98 Merged-In: I0ecae20d514bf888f3a80331f19369ceb1c52aa3
2019-01-30Remove last NetworkStack usage of hidden APIsRemi NGUYEN VAN
Includes various small changes to stop using hidden APIs Test: make NetworkStack Test: flashed, booted, WiFi and tethering working Bug: 112869080 Change-Id: Id2830795a444f484b377ed6437435a1cd833697a
2019-01-29Remove IpClient usage of NetworkManagementServiceRemi NGUYEN VAN
Use the new NetworkObserverRegistry instead. Test: atest FrameworksNetTests NetworkStackTests Test: flashed, WiFi working fine Bug: 112869080 Change-Id: If16ecfd6489f86afec67c22b4c3692cd68f4edbf
2019-01-28Add NetworkObserverRegistry to NetworkStackRemi NGUYEN VAN
The NetworkObserverRegistry will replace usage of NetworkManagementService in the app. Test: m, booted, WiFi working Bug: 112869080 Change-Id: Ic7f0114d0c9361dd2408e47bb04a8dd44a908a47
2019-01-23Move IpClient to NetworkStackRemi NGUYEN VAN
Test: atest FrameworksNetTests NetworkStackTests Bug: b/112869080 Change-Id: I7d00848c052382cd1b6ce458868bed6a1e9e8ec5
2019-01-21Allow Bluetooth to bind to NetworkStackRemi NGUYEN VAN
Test: flashed, verified bluetooth tethering gets IP address Bug: b/112869080 Change-Id: Idfbfdf54754fea46eb0099b9b9a3bdc29dd241e0
2019-01-11Move NetworkMonitor to NetworkStackRemi NGUYEN VAN
Bug: b/112869080 Test: atest FrameworksNetTests NetworkStackTests Change-Id: I1b8b6a3f4390adbabf92fb9e48da61c47b08b2ec
2019-01-09Move DhcpServer to NetworkStack appRemi NGUYEN VAN
Test: atest FrameworksNetTests && atest NetworkStackTests Bug: b/112869080 Change-Id: I96c40e63e9ceb37b67705bdd4d120307e114715b
2018-12-25Add NetworkStack appRemi NGUYEN VAN
The app is not started yet, and does not contain any service for now. Test: built, booted Bug: b/112869080 Change-Id: Id5a0fd02c891100e85d86b1040e53beec3581950