Commit Graph

70 Commits

Author SHA1 Message Date
Treehugger Robot
1d18e60e76 Merge "Consider 200 response with "Content-length <= 4" to not be a captive portal." 2019-02-20 11:14:24 +00:00
Xiao Ma
e7e5a35b38 Merge "Replace TcpSocketInfo with TcpKeepalivePacketDataParcelable in ApfTest." 2019-02-18 07:12:04 +00:00
Remi NGUYEN VAN
e4a40c77e1 Merge "Rename NetworkStack package" 2019-02-18 01:07:51 +00:00
Remi NGUYEN VAN
fd2d7dc685 Merge "Sign networkstack with its own certificate" 2019-02-16 01:48:49 +00:00
Remi NGUYEN VAN
3f23efdd13 Merge "Fix framework and NetworkStack classes conflicts" 2019-02-16 00:22:29 +00:00
Xiao Ma
6b4de8faf7 Replace TcpSocketInfo with TcpKeepalivePacketDataParcelable in ApfTest.
Test: atest NetworkStackTests
Change-Id: I95fde70c07b398a2a2f734f35165870284a3959c
2019-02-15 19:22:36 +09:00
Remi NGUYEN VAN
ab96bc758e Sign networkstack with its own certificate
The NetworkStack module is comprised of 2 updatable APKs
(NetworkStack.apk and CaptivePortalLogin.apk), and a stub APK to define
the signature permissions for the APKs (NetworkStackPermissionStub.apk).

Test: flashed, WiFi works, captive portal login works
Bug: 124033493
Change-Id: I772d1d63363a3eb6f817c21906498bd2385ab02b
2019-02-15 17:53:00 +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
d989ed753d Merge "Add NetworkStackTests to device-tests suite" 2019-02-15 08:16:03 +00:00
Remi NGUYEN VAN
bfe928d593 Merge "Remove NetworkMonitor dependency on ICaptivePortal" 2019-02-15 08:09:29 +00:00
Xiao Ma
60e7162e05 Merge "Fix testApfFilterKeepaliveAck." 2019-02-15 04:04:32 +00:00
Dan Shi
b350df2941 Add NetworkStackTests to device-tests suite
It's needed for the test to run in a Test Mapping suite.

Bug: 123544631
Test: local build
Change-Id: I0678a3e8f9beed7c637c1b11594369aa5d3c87bf
2019-02-15 12:35:04 +09:00
Remi NGUYEN VAN
cfff01e2db Remove NetworkMonitor dependency on ICaptivePortal
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-15 12:20:03 +09:00
Remi NGUYEN VAN
d36e3df7b0 Merge "Remove deps from framework on netd interfaces" 2019-02-15 03:11:31 +00:00
Xiao Ma
d36a89ccd6 Fix testApfFilterKeepaliveAck.
Apf program for TCP keep alive ACK also compares protocol field in IPv4
header and the total length of TCP keep alive ACK packet. Besides,
should set the ACK flag in the the TCP header of keep alive ACK packet.

Bug: 123992564
Test: atest NetworkStackTests
Change-Id: I997cd6807a33f7e1af25566226d803dcc2e257dd
2019-02-14 19:16:01 +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
Chiachang Wang
a75c52c3df Merge "Use ServiceState to get data cell ID" 2019-02-14 07:24:16 +00:00
Hongshik
1da51fcdc4 Add "close" socket option for immediately close socket after finish check captive portal.
Unexpected packets are observed after captive portal check. Due to the packets, modem can't fall-back to idle state (modem remained as active state).
It makes unnecessary power consumtion.
To prevent it, "close" option is added in sendHttpProbe()

Test: check socket close.
Change-Id: I5b6987071ad915081846504adbb209eb371fd1c3
2019-02-14 10:51:51 +09:00
Chiachang Wang
7561071dfb Use ServiceState to get data cell ID
ServiceState now contains a CellIdentity that can be obtained
specifically from the data subscription, and for PS on cell
only.

This should be used for connectivity level network monitoring
info.

Bug: 123893112
Test: 1. atest NetworkMonitorTest
      2. Verify if cell id is correct

Change-Id: Ieb00de84a0d518e3197e3884f946b872e998304a
2019-02-14 09:30:58 +08:00
Remi NGUYEN VAN
749dfc3083 Merge "Remove INTERACT_ACROSS_USERS_FULL for NetworkStack" 2019-02-12 04:47:43 +00:00
Sehee Park
8e9a15bdbd Consider 200 response with "Content-length <= 4" to not be a captive portal.
There's no point in considering this a captive portal as the user cannot
sign-in to an empty page. Probably the result of a broken transparent proxy.

Bug: 122999481
Test: Manual

Change-Id: I1ca44092ac05a1708d9b41c5a4aad545b71b7eab
Signed-off-by: Sehee Park <sehee32.park@samsung.com>
2019-02-12 04:15:05 +00:00
Remi NGUYEN VAN
e765e8b7aa Merge "Remove hard-coded NetworkStack package name" 2019-02-12 03:58:09 +00:00
Remi NGUYEN VAN
8c0d94608c Rename NetworkStack package
Set the new name to com.android.networkstack. Also rename the stub APK
to com.android.networkstack.permissionstub.

Also add shared UID to the NetworkStackPermissionStub to enforce
signature restrictions on the UID.

Test: booted, WiFi working
Bug: 124033493
Change-Id: Id8967db08b7faaa659b20f86f1013493eb0e188f
2019-02-08 15:32:21 +09:00
Remi NGUYEN VAN
9c5d964902 Remove hard-coded NetworkStack package name
Have the network stack pass its package name in
showProvisioningNotification instead.

Bug: 124033493
Test: flashed, WiFi and captive portal works
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I1f3312768ba1fb34e99a827e1fcdaf7510e318a8
2019-02-08 12:12:57 +09:00
Remi NGUYEN VAN
f871bfb8c7 Remove INTERACT_ACROSS_USERS_FULL for NetworkStack
Replace with INTERACT_ACROSS_USERS, which is needed to send the
ACTION_NETWORK_CONDITIONS_MEASURED broadcast.

Also cleanup some non-privileged permissions that were added to the
priv-app file.

Test: built, booted, broadcast and captive portal login work
Bug: 123846255
Change-Id: I3c97c166e80c19bf57fa047709c8b91fca75d635
2019-02-07 02:39:57 +00:00
Remi NGUYEN VAN
ca551ce981 Merge "Add API for NetworkStack to start captive portal" 2019-02-07 02:39:17 +00:00
Aaron Huang
a63c40e0de [KA07] Drop TCP keepalive ack packets
To support TCP keepalive offload, APF filter needs to add program
for dropping keepalive ack packets when offload is starting.

Bug: 114151147
Test: runtest frameworks-net -c android.net.apf.ApfTest
Change-Id: If16a9bc04eb29dfedb950b6e4c85fe9ad4cf259f
2019-02-06 22:51:49 +09:00
junyulai
352dc2f202 [KA04] Expose TCP socket keepalive API
The new set of API allows applications to request keepalives
offload for established TCP sockets over wifi.

However, the application must not write to or read from the
socket after calling this method, until specific callbacks are
called.

Bug: 114151147
Test: atest FrameworksNetTests FrameworksWifiTests NetworkStackTests

Change-Id: I3880505dbc35fefa34ef6c79555458ecf5d296a4
2019-02-06 22:51:42 +09:00
Remi NGUYEN VAN
dc48356147 Add API for NetworkStack to start captive portal
Endpoints protected with INTERACT_ACROSS_USERS_FULL, such as
startActivityAsUser, should only be used by modules signed with the
platform cert. The NetworkStack needs to have the system server start
the application so this restriction can be applied.

Bug: 123846255
Test: flashed, captive portal works from primary and secondary user
Change-Id: Ib3e427b3fd03ced80c02985e795f79b096a2ec9a
2019-02-06 16:38:32 +09:00
Bernie Innocenti
c3586eaa4d Give owneship of packages/NetworkStack to Android Core Networking
Test: ../../build/make/tools/checkowners.py packages/NetworkStack/OWNERS
Change-Id: I6254f1ac2a24611ca6901f8f940d9e5babaaf373
2019-02-06 16:20:35 +09:00
Remi NGUYEN VAN
0fe59007ce Merge "Add NetworkStackPermissionStub definitions" 2019-01-31 14:13:22 +00:00
Remi NGUYEN VAN
74b1c8626e Merge "Prepare CaptivePortalLogin for system_current" 2019-01-31 12:46:00 +00:00
Remi NGUYEN VAN
d8c75a0438 Add NetworkStackPermissionStub definitions
The NetworkStackPermissionStub package is used to enforce that
permissions used by the NetworkStack are only used in packages
sharing signature with NetworkStackPermissionStub.

Permissions defined in this package are intended to be used only by the
NetworkStack: both NetworkStack and the stub APK will be signed with
a dedicated certificate to ensure that, with permissions being signature
permissions.

This APK *must* be installed, even if the NetworkStack app is not
installed, because otherwise, any application will be able to define
this permission and the system will give that application full access
to the network stack.

Test: flashed, booted
Bug: 112869080
Change-Id: Ia13a9e6a703cb7b4403697a7f7bfff0f6f3b813e
2019-01-31 21:16:13 +09:00
Remi NGUYEN VAN
47274275cf Prepare CaptivePortalLogin for system_current
Includes small changes to stop using non-SystemApi endpoints.

Test: make CaptivePortalLogin
Test: flashed, login works, SSL certificate invalid flow works
Bug: 112869080
Merged-In: Ic6ce98942959705ea7ef14a7a62d33e3abf7eb72
Change-Id: Ie7ea3bab6aa8629ce4c111adee0c0699d95d4b0e
2019-01-31 18:14:54 +09:00
Remi NGUYEN VAN
3b906878f8 Fix bluetooth tethering on multi-user
Bluetooth runs as UID 1001002 when on a secondary user. With this change
the NetworkStack verifies that the calling UID matches the Bluetooth app
regardless of the user.

Test: flashed, BT reverse tethering still working as primary user
      (no option to turn on as secondary user on phones)
Bug: 123655057
Change-Id: I23f9c5fa40f3bb676ac65dd8c15106c9d78309a4
2019-01-31 16:03:21 +09:00
Remi NGUYEN VAN
55849979a5 Merge "Add SystemApi for captive portal metrics" 2019-01-30 22:24:12 +00:00
Remi NGUYEN VAN
de60221ec8 Add SystemApi for captive portal metrics
The metrics go through NetworkMonitor in the NetworkStack so that they
can be upgraded to new metrics in the future.

Test: flashed, captive portal login works, metrics shown in events log
Bug: 112869080
Merged-In: I4bccfbd87bae5b2d65e45c7a5918aa45ab5d76e8
Change-Id: Ib5e2126788f8d56a00a56d7efcd33c5f9a37a6de
2019-01-30 22:54:27 +09:00
Remi NGUYEN VAN
4c30b419f8 Compile NetworkStack as system_current
Test: make NetworkStack
Test: flashed, WiFi and tethering working
Bug: 112869080
Change-Id: I2d805c0fefe271199f4f0e0d49d91e03f41a7eef
2019-01-30 10:23:29 +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
Treehugger Robot
4a838a68d6 Merge "Move FdEventsReader to the shared area." 2019-01-29 11:45:15 +00:00
Chalard Jean
0bf364d92e Move FdEventsReader to the shared area.
This is necessary both in the network stack app and the
framework.

Test: FrameworksNetTests
Change-Id: I48af0ab29405501f0581a6c0c9ce6e5d4a32c8b4
2019-01-29 18:35:11 +09:00
Remi NGUYEN VAN
1bbed8a3b8 Run IpClientLinkObserver on Binder thread
This restores previous behavior, where callbacks would not be called on
the IpClient handler thread.

Test: atest FrameworksNetTests NetworkStackTests
Test: flashed, WiFi works
Bug: 123062477
Change-Id: I3015566b0922d76ac7cf70579a1de3e033bf7b4a
2019-01-29 17:09:01 +09:00
Remi NGUYEN VAN
31d7447e04 Remove IpClient usage of NetworkManagementService
Use the new NetworkObserverRegistry instead.

Test: atest FrameworksNetTests NetworkStackTests
Test: flashed, WiFi working fine
Bug: 112869080
Change-Id: If16ecfd6489f86afec67c22b4c3692cd68f4edbf
2019-01-29 11:37:01 +09:00
Remi NGUYEN VAN
567cc7890a Merge "Add hidden utils and constants to NetworkStack" 2019-01-28 11:08:00 +00:00
Remi NGUYEN VAN
b8bbc48dee Merge "Move NetworkUtils used by NetworkStack" 2019-01-28 09:06:20 +00:00
Remi NGUYEN VAN
375b3c075d Merge "Add NetworkObserverRegistry to NetworkStack" 2019-01-28 08:54:06 +00:00
Remi NGUYEN VAN
f4fb1b5251 Merge "Add NetworkStack tests to postsubmit" 2019-01-28 08:53:13 +00:00
Remi NGUYEN VAN
9188b49259 Merge "Add NetworkStack networking deps to SystemApi" 2019-01-28 08:12:55 +00:00
Remi NGUYEN VAN
e4195cd6ed Add NetworkObserverRegistry to NetworkStack
The NetworkObserverRegistry will replace usage of
NetworkManagementService in the app.

Test: m, booted, WiFi working
Bug: 112869080
Change-Id: Ic7f0114d0c9361dd2408e47bb04a8dd44a908a47
2019-01-28 14:55:50 +09:00
Remi NGUYEN VAN
3ba6c0d56d Add hidden utils and constants to NetworkStack
Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: I1a803f7954ab760294436226d6c1cffb934e98f9
2019-01-28 13:45:27 +09:00