498 Commits

Author SHA1 Message Date
Xiao Ma
17ea70c6d3 Merge "Add DHCP address lease expiry in IpMemoryStore." 2019-04-01 12:59:20 +00:00
Remi NGUYEN VAN
78454f3c46 Merge "Fix race when starting NetworkMonitor" 2019-04-01 03:54:03 +00:00
Remi NGUYEN VAN
3962f678c3 Fix race when starting NetworkMonitor
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-04-01 11:33:10 +09:00
Luke Huang
b9ef4dd299 Merge "Use IDnsResolver instead of INetd for resolver related binder commands" 2019-03-29 08:45:19 +00:00
Xiao Ma
385ccb05c8 Add DHCP address lease expiry in IpMemoryStore.
Bug:122710829
Test: atest FrameworksNetTests
Change-Id: I643fe1231edcd18923514ab66c64a6cf83e69443
2019-03-29 16:51:47 +09:00
Colin Cross
50fadbee32 Fix glob syntax
Globs are only intended to support ** as a directory, i.e. **/*.java
not **.java.

Bug: 129411151
Test: m nothing
Change-Id: I0f6cb7c7ce8cd1ef8c09364c0946ac7157285a4d
2019-03-27 11:26:57 -07:00
Luke Huang
6591477a5b Use IDnsResolver instead of INetd for resolver related binder commands
migrate resolver related commands from INetd to IDnsResolver

Bug: 126141549
Test: atest FrameworksNetTests ConnectivityServiceTest Nat464XlatTest
      atest DnsManagerTest
Change-Id: I559c0c1304d53dde408c062e1a52e742595e7cbe
2019-03-27 17:39:07 +08:00
Treehugger Robot
021ea66aea Merge "Use SystemApi framework parcelables directly" 2019-03-27 02:55:15 +00:00
Remi NGUYEN VAN
266868246a Use SystemApi framework parcelables directly
Remove StaticIpConfigurationParcelable and ApfCapabilitiesParcelable and
use StaticIpConfiguration and ApfCapabilities directly.
These two classes are SystemApi and defined in framework.jar, so no
stability guarantee is needed: the parceled and unparceled class will
always be the framework.jar version.

Bug: 126477266
Fixes: 126477266
Test: atest FrameworksNetTests NetworkStackTests
Test: flashed, booted, WiFi and captive portal works.
Change-Id: Iaf80ae23e003752cc6d2300700021931923b6533
2019-03-26 12:05:27 +09:00
Mark Chien
6aef2afd4e Merge "[TCPKeepalive] Fill correct TOS and TTL value" 2019-03-25 13:10:17 +00:00
markchien
1fc82b223f [TCPKeepalive] Fill correct TOS and TTL value
Fill correct TOS/TTL value by fetching them from kernel with
getsockopt.

bug: 123967966
Test: -build, flash, boot
      -atest FrameworksNetTests

Change-Id: I75b1be51040b4a381163958b4cddd27dbb22bac1
2019-03-25 11:14:57 +08:00
Remi NGUYEN VAN
0bd294cd55 Separate NetworkMonitor/framework portal URL
The framework cannot return URLs used by the updatable NetworkStack,
which may use configurable URLs, changing URLs, or mechanisms not
involving URLs to detect captive portals. NetworkMonitor has already
been using random fallback URLs for a while that do not match the value
returned by ConnectivityManager#getCaptivePortalServerUrl.

With this change, the default value returned by the framework is
configured in framework resources as
config_networkDefaultCaptivePortalServerUrl. NetworkMonitor behavior may
change as it is an updatable component, but the current URL is
configured in NetworkMonitor resources as
config_captive_portal_http_url.

Test: flashed, booted, WiFi and captive portal working
Test: ConnectivityManager#getCaptivePortalServerUrl returns correct
      value.
Bug: 127908503
Change-Id: I371dedc5b22efa909d7fd58e1ebe9b8aaced9780
2019-03-22 15:11:14 +09:00
Lorenzo Colitti
0c089bcc82 Merge changes I2e8c2ad9,Ic4f4c7d2
* changes:
  Move the networkstack AIDL interfaces to services/net.
  Remove the framework dependency on networkstack-aidl-framework.
2019-03-22 00:23:22 +00:00
Paul Hu
43c1ade661 Merge "Fix Automated API Review issues." 2019-03-21 17:19:26 +00:00
Lorenzo Colitti
306e8cd9e7 Move the networkstack AIDL interfaces to services/net.
Nothing in the framework uses these, so there is no point in
having the build be in frameworks/base/Android.bp.

Fix: 128804404
Test: builds, boots
Test: atest FrameworksNetTests
Change-Id: I2e8c2ad9ea8bfcd3668a83e4c044de10389a8a22
2019-03-21 23:23:57 +09:00
paulhu
d9736de38b Fix Automated API Review issues.
1. Some API's argument/return value must be marked either
@NonNull or @Nullable.
2. Change some system APIs to public APIs.
3. Modify the method name

Bug: 126700123
Bug: 126702339
Bug: 126699682
Bug: 118296575
Bug: 126699216
Bug: 126699675
Bug: 126699429
Bug: 126699193
Bug: 123586045
Test: atest FrameworksNetTests
Change-Id: Iaa2832cdcf83758ed0fec81b954a0c63bc5a7bf6
2019-03-21 13:55:37 +08:00
markchien
d42fca678e Replace TcpSocketInfo with similar structure
Replace TcpSocketInfo with TcpKeepalivePacketDataParcelable
because their structures are very similar.

bug: 128882321
Test: -build, flash, boot
      -FrameworksNetTests

Change-Id: Iafb4031a64ba4775a495c156e2c997d890c6b261
2019-03-20 22:29:48 +08:00
Lorenzo Colitti
a3f811a547 Move TcpKeepalivePacketData out of the framework.
This class is not used in framework.jar, only in services.jar.
Move it out of the framework so framework.jar can stop depending
on the NetworkStack stable AIDL interfaces.

This should really under com.android.server as well, but that's
a cross-project change to be done in another CL.

Test: m
Bug: 128804404
Change-Id: Ib2805f7fcc516a5f6989c252365d1c95b8042703
Merged-In: Ib2805f7fcc516a5f6989c252365d1c95b8042703
2019-03-20 08:56:31 +09:00
Chalard Jean
952135122d Move the IpMemoryStore to the network stack.
Test: atest FrameworksNetTests
Change-Id: Ic5bd6ff54b09a6fa92b6863f240a5b053011acb6
2019-03-18 11:33:17 +09:00
Remi NGUYEN VAN
205886d28f Merge "Remove NetworkParcelable" 2019-03-18 01:30:25 +00:00
Remi NGUYEN VAN
1a1396070e Merge "Remove aidl wrappers for framework parcelables" 2019-03-18 01:30:01 +00:00
Remi NGUYEN VAN
904a38be5e Remove NetworkParcelable
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-16 03:51:09 +09:00
Remi NGUYEN VAN
e80be85790 Remove aidl wrappers for framework parcelables
The new @JavaOnlyStableParcelable annotation allows using the framework
parcelables directly, which removes a lot of boilerplate.

Includes new copy constructors for IpPrefix and LinkAddress so they can
be copied easily as-is into parcelables.

Test: atest FrameworksNetTests
Test: booted, WiFi works
Bug: 126477266

Change-Id: Icac8afe498d0b5ebf9a0d0b9eceb14d64a29b381
2019-03-16 03:50:58 +09:00
Remi NGUYEN VAN
389443ceda Initialize the NetworkStack before WiFi
The NetworkStack needs to be marked as start requested before any client
can use it from the system server, so it knows to queue requests until
it actually comes up.

This fixes a bug introduced in commit:
I93315ad31925bd436e21d1eabb21d5967e6aae60
where a client trying to use the network stack in the system server
before ActivityManager.systemReady() could block and eventually timeout,
resulting in a null INetworkStackConnector.

Test: booted, WiFi working
Bug: 128620654

Change-Id: Ieca2657373eba78195b387fb266fa0424fce8ada
2019-03-15 08:24:07 +09:00
Remi NGUYEN VAN
b8f2ab9362 Merge "Use an in-process APK for in-process NetworkStack" 2019-03-12 01:37:26 +00:00
Treehugger Robot
a6f3476476 Merge "Give Telephony the permissions to access the network stack." 2019-03-08 15:55:53 +00:00
Bernie Innocenti
e5e3ac639b Merge "Add junyulai@ as owner of the core networking dirs" 2019-03-08 15:21:01 +00:00
Bernie Innocenti
ea89cf2c6e Add junyulai@ as owner of the core networking dirs
Also removed emeritus accounts ek@ and silberst@ from various places.
A cleanup using 'include' would probably be in order...

Test: N/A
Change-Id: I575e60dd5e600e42d9571ce8e8d7661d30e99bfe
2019-03-08 13:04:05 +00:00
Chalard Jean
12aaf7e2ef Give Telephony the permissions to access the network stack.
Test: manual
Change-Id: I28308f421aa955fe110b50452b115a0178b24745
2019-03-08 20:43:10 +09:00
Remi NGUYEN VAN
8acc99a974 Use an in-process APK for in-process NetworkStack
Instead of having a library in the classpath where the NetworkStack is
created by reflection on devices using the network stack in-process,
just bind to a version of the network stack service that runs in the
system process.

If the in-process version is installed it will be used, otherwise the
module is used with its own process.

Bug: 127908503
Test: blueline boots and has functional WiFi
Test: atest FrameworksNetTests NetworkStackTests
Test: svelte build boots and has functional WiFi
Change-Id: I7722b173e5686e0dbb9cfddcfb34344b0f4135d9
2019-03-08 19:18:40 +09:00
Jimmy Chen
086779de11 IPv6: enable IPv6 link local routing for local network
IPv6 link local is an automatically configured address. The routing should be
activated regardless of the DHCP service.

Bug: 126063997
Test: Unit tests - atest FrameworksNetTests
Test: Unit tests - atest FrameworksWifiTests
Test: * DUT1 enables hotspot
      * DUT2 associates to DUT1
      * use ping6 to verify the local link on both side
Test: * DUT1 creates a P2P group
      * DUT2 joins this group as a legacy client
      * use ping6 to verify the local link on both side

Change-Id: I102bf29e8da14808097e43c840d74d41b6b3758f
2019-03-08 16:34:20 +08:00
Remi NGUYEN VAN
b7bda39d90 Fix SocketUtils API
- connect, sendTo, bind were added as public API, so do not need to be
   maintained as SystemApi in SocketUtils. These APIs were added in Q
   timeframe.
 - Add @Nullable/@NonNull annotations.

Bug: 126699304
Bug: 126477266
Test: booted, WiFi works
Change-Id: I3f086ac8952cfd6a4d8f861d2e1c7aa1ca8be999
2019-03-06 18:02:34 +09:00
Lorenzo Colitti
1d8977b992 Merge "Fix RouterAdvertisementDaemon thread leakage problem" 2019-02-22 07:39:20 +00:00
Iris Chang
6dea37dc6e Fix RouterAdvertisementDaemon thread leakage problem
[Prerequisites]
Default value of mRaLength is 0, so getNextMulticastTransmitDelaySec()
returns DAY_IN_SECONDS (1 day) in this scenario.

[Issue Details]
Examine MulticastTransmitter.run() for detail:

676        public void run() {
677            while (isSocketValid()) {
678                try {
679                    Thread.sleep(getNextMulticastTransmitDelayMs());

Invoke RouterAdvertisementDaemon.stop() here. Since MulticastTransmitter
is in a sleep, this thread will pend 1 day until the next check of
isSocketValid() triggers the quit action, which causes thread leakage
during Wi-Fi Hotspot on/off stress test.

680                } catch (InterruptedException ignored) {

[Solution]
Invoke maybeNotifyMulticastTransmitter() after closing socket in
RouterAdvertisementDaemon.stop() to interrupt MulticastTransmitter from
waiting.

Bug: 123491872
Test: FrameworksNetTests
  adb shell am instrument -w com.android.frameworks.tests.net
Test: CTS - CtsNetTestCases
  ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m CtsNetTestCases
Test: CTS - CtsNetTestCasesLegacyApi22
  ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m
  CtsNetTestCasesLegacyApi22
Test: CTS - CtsNetTestCasesLegacyPermission22
  ANDROID_BUILD_droid-cts/tools/cts-tradefed run cts -m
  CtsNetTestCasesLegacyPermission22

Change-Id: I0c0d63b43a88e1026aaecfc1853309ad63f62268
2019-02-21 09:19:29 +00:00
Remi NGUYEN VAN
a25379f577 Add logging to NetworkStackClient
The current logging relies on the system log that may rotate. This is a
problem to investigate bugs where the network stack service is not
started. Add a SharedLog to NetworkStackClient and dump it in
ConnectivityService (for lack of a better place to dump it).

Bug: 124307802
Test: Booted, dumpsys connectivity shows the log
Change-Id: If596451d0613645f68a8a32acb032eea76ea506c
2019-02-21 17:09:12 +09:00
Remi NGUYEN VAN
256298eb94 Change getPackageUid to getPackageUidAsUser
The wrong overload of PackageManager is being called, setting
USER_SYSTEM as flag instead of the user to resolve the network stack
UID.

Test: phone boots, WiFi works, additional tests in child CLs
Change-Id: I89b11b38c390d0e77a5917c74daccccd74c2d0a3
2019-02-21 17:07:57 +09:00
Remi NGUYEN VAN
1b57e8e9db Fix framework and NetworkStack classes conflicts
Classes that are used in framework.jar cannot be linked in NetworkStack,
as the framework takes precedence in the classpath. This prevents the
networkstack from using these classes due to the hidden API usage
detection.

Do the following:
 - jarjar any shared source file between framework and NetworkStack, so
   the version in the NetworkStack uses a different package.
 - Move any shared class not used in the NetworkStack to services.net

The CL  uses jarjar on the app copy and not the framework classes, as
the framework cannot be updated without an OTA, and non-network stack
specific classes should not be renamed because of the network stack.

Test: atest FrameworksNetTests NetworkStackTests
Test: flashed svelte build, WiFi works
Bug: 124033493
Change-Id: I85d888b756adc28c36638913632bfdfdbf0e0486
2019-02-15 17:30:07 +09:00
Remi NGUYEN VAN
5db454c28d Move NetworkStack to services.net
NetworkStack is only used in services.net or clients of services.net. It
cannot stay in framework.jar because it needs to depend on AIDL
interfaces, which would conflict with app implementations if they were
in framework.jar.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 124033493
Change-Id: Ib1d08a3669983640119d008db7e2990fa798724f
Merged-In: I501b125a388c1100c2182bde4670944c2f0d7a02
2019-02-15 12:20:17 +09:00
Remi NGUYEN VAN
dacee147b4 Remove deps from framework on netd interfaces
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-02-14 17:26:59 +09:00
Remi NGUYEN VAN
231b52bc03 Remove last NetworkStack usage of hidden APIs
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-30 10:23:24 +09:00
Remi NGUYEN VAN
9fdc6d2963 Merge "Revert "Extract network observer code from NetworkManagementService."" 2019-01-29 14:30:56 +00:00
Remi NGUYEN VAN
bfd0aa022e Revert "Extract network observer code from NetworkManagementService."
This reverts commit d8bc829a85c9c9bb390e18b59ef1455b6d0b94ec.

Reason for revert: Refactoring was unnecessary

Merged-In: Ib4e7da3274e49f25676505a08e6ce7e7b0dfdb8d
Change-Id: Iff332c680315b560f0b762c1d7311ec83d539115
2019-01-29 10:21:19 +00:00
Remi NGUYEN VAN
b8bbc48dee Merge "Move NetworkUtils used by NetworkStack" 2019-01-28 09:06:20 +00:00
Remi NGUYEN VAN
e3f18bd77c Merge "Add INetd to SystemServiceRegistry" 2019-01-28 08:27:02 +00:00
Remi NGUYEN VAN
9188b49259 Merge "Add NetworkStack networking deps to SystemApi" 2019-01-28 08:12:55 +00:00
Remi NGUYEN VAN
e88516f13b Move NetworkUtils used by NetworkStack
Depending on usage move into NetworkStackUtils or shared
Inet4AddressUtils.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Merged-In: Ie20dcee375b377236004a7689890729493aca857
Change-Id: Ib8d000529872796022706a35050fdc2c7141f2ab
2019-01-28 13:45:17 +09:00
Remi NGUYEN VAN
a4bcc86dbe Add NetworkStack networking deps to SystemApi
Cherry-pick with conflicts fixed in CaptivePortalLoginActivity imports.
Test: atest FrameworksNetTests
Bug: 112869080
Merged-In: Id59dc06fb85e4ac88098f56b621ec880610759ce
Change-Id: I3c05e8fdd70497426d4fa433295c4fbdad07d9c9
2019-01-28 13:28:35 +09:00
Remi NGUYEN VAN
3193598566 Add INetd to SystemServiceRegistry
Includes @SystemApi for Context.NETD_SERVICE so system apps (including
the network stack) can obtain the service.

Test: m
Bug: 112869080
Change-Id: Ida63747cd30abb7b3c19559803353eb0e42e6efa
2019-01-28 12:13:08 +09:00
Remi NGUYEN VAN
bc19ab1553 Remove IpClient wrapper
The wrapper was useful to help clients migrate out of the old API, but
all clients are now migrated.
It also conflicts with IpClient in the NetworkStack on Go devices.

Test: Flashed, booted, WiFI works
Bug: 123371264
Change-Id: Ibf04ad9371a07d2c66c478547539ba41c540116f
2019-01-25 15:07:04 +09:00
Lorenzo Colitti
d8bc829a85 Extract network observer code from NetworkManagementService.
This will allow us to use network observers in the NetworkStack
app without duplicating too much code.

Bug: 112869080
Test: atest FrameworksNetTests
Test: builds, boots, wifi works
Change-Id: If54fa3a88110ffa815899d385dbb0d5770abaead
2019-01-25 00:41:57 +09:00