Commit Graph

6177 Commits

Author SHA1 Message Date
Luke Huang
e17bb2dff4 Fix cancellation race problem for aysnc DNS API
This problem might cause double-close fd and result in app crash
or unexpected behaviour

Bug: 129317069
Test: atest DnsResolverTest
      manual test with delaying response callback/cancel
Change-Id: I223234f527edafc51d34fa6be390419c05def8d8
2019-03-28 19:46:56 +08:00
chen xu
3555617d90 Merge "support msim for captiveportal notification"
am: 5c83418408

Change-Id: I3bed0b6d44a13a4dd1c68b21a28b75e4e6c7aa81
2019-03-27 20:42:44 -07:00
Treehugger Robot
5c83418408 Merge "support msim for captiveportal notification" 2019-03-28 03:28:19 +00:00
Junyu Lai
a0540419f9 Merge changes I0baf582f,I4bba01ba
am: 6d7c97dc5c

Change-Id: Ie69a03e6c61e172ba7e9948706fe6780be61a41b
2019-03-27 18:17:27 -07:00
Junyu Lai
6d7c97dc5c Merge changes I0baf582f,I4bba01ba
* changes:
  Block unpriviledged apps which create keepalives with null fd
  Fix keepalive don't get removed when lower layer error
2019-03-28 00:53:20 +00:00
junyulai
828dad188c Block unpriviledged apps which create keepalives with null fd
Currently, socketKeepalive implementation is accepting null fd
due to backward compatibility with legacy packet keepalive API.
However, due to lack of the fd, the service cannot guarantee the
port is not reused by another app if the caller release the port
for any reason.

Thus, grant the null fd access only for priviledged apps.

This commit also address some comments from aosp/918533.

Bug: 126699232
Test: atest FrameworksNetTests
Change-Id: I0baf582ff4ca8af6082c3754e8dfbcd867f39792
2019-03-27 19:51:08 +08:00
Luke Huang
8141319b4d 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
chen xu
5b5447e421 support msim for captiveportal notification
Bug: 123025093
Test: Manual
Change-Id: Ie04f3ae9a825ab75077a94b108ac92075b6d4753
2019-03-27 00:11:52 -07:00
Chenbo Feng
2a029a210c Merge "Get the permission information for native services"
am: 743a1c8001

Change-Id: I806e3e948dfab0cc8c691c20f377bbc3a24240a6
2019-03-26 22:33:27 -07:00
junyulai
8b381dd91b Fix keepalive don't get removed when lower layer error
Currently, if the lower layer, e.g. wifi, didn't successfully
start keepalive by any reason. Due to the startedState changed
to NOT_STARTED first, the logic inside stop() will skip the
removing process and cause leak.

Thus, moving the changing of startedState to proper place first
to unblock subsequent changes first.

Bug: 123988249
Bug: 129371366
Test: atest FrameworksNetTests
Change-Id: I4bba01bacc80e1dac2023ef831b5ade5501894e4
2019-03-27 11:38:58 +08:00
Chenbo Feng
5289cdd37e Merge "Fix the INTERNET related permissions"
am: 65cef6401a

Change-Id: Id97b1ea945409e938158f30efd564b10c9e81380
2019-03-26 19:52:57 -07:00
Chenbo Feng
d72e9ab720 Get the permission information for native services
For native services such as mediaserver and audioserver, the permission
information cannot be retrieved from getInstalledPackages. Instead, the
high level permission information is avalaible in systemConfigs. With
those permission information, netd can store the complete list of uids
that have UPDATE_DEVICE_STATS permission.

Bug: 128944261
Test: dumpsys netd trafficcontroller
Change-Id: I0331d5a3a5b927a351fcfe6689ef1ba2b993db0c
2019-03-27 02:45:37 +00:00
Treehugger Robot
65cef6401a Merge "Fix the INTERNET related permissions" 2019-03-27 02:35:35 +00:00
Lucas Lin
b7977acec0 Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity"
am: 52feef4450

Change-Id: I0639d4ccd7c3211595ede82bce3daa87ae759e10
2019-03-26 18:41:00 -07:00
Lucas Lin
52feef4450 Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity" 2019-03-27 01:29:51 +00:00
Chenbo Feng
0c4742527b Fix the INTERNET related permissions
Change the INTERNET permission implementation so it only block socket
creation when non of the packages under the same uid have internet
permission. Fix the UPDATE_DEVICE_STATS permission so only the uid that
own the permission can change it.

Bug: 111560570
Test: CtsNetTestCasesUpdateStatsPermission
      CtsNetTestCasesInternetPermission
Change-Id: I42385526c191d4429f486cde01293b27fcc1374b
2019-03-26 15:16:26 -07:00
lucaslin
9df5336349 Fix flaky test for ConnectivityServiceTest#testPartialConnectivity
There are 2 problems will make testPartialConnectivity flaky:
1. If we call setNetworkValid() before expectCapabilitiesWith(),
there may be a timing issue that network will become VALID before
NetworkMonitor send PARTIAL_CONNECTIVITY to ConnectivityService.
Solution:
We should set network to valid after ConnectivityService received
NETWORK_TEST_RESULT_PARTIAL_CONNECTIVITY to ensure NetworkMonitor
will send PARTIAL_CONNECTIVITY to ConnectivityService first then
send VALID.

2. When test case call explicitlySelected(true) first then call
connect(true), NetworkMonitor will report the network validation
test result twice because ConnectivityServiceTest() will trigger
notifyNetworkTested() when setAcceptPartialConnectivity() is
called, it may cause a timing that before the second test result
send to ConnectivityService, connect() already called
setNetworkInvalid. So, NET_CAPABILITY_VALIDATED will be removed
and ConnectivityService will trigger onCapabilitiesChanged()
unexpectedly.
Solution:
Don't trigger notifyNetworkTested() when
setAcceptPartialConnectivity() is called. If there is needed,
use mCm.reportNetworkConnectivity() to report the test result
instead.

Bug: 128426024
Test: 1. atest FrameworksNetTests: \
      ConnectivityServiceTest#testPartialConnectivity \
      --generate-new-metrics 1000

Change-Id: I7200528378201a3c7c09a78ff827b41f2741dfa1
2019-03-26 17:49:49 +08:00
Junyu Lai
ff5f8defa6 Merge "Reveal the call trace of failed test cases which run in executors"
am: 67cfb00800

Change-Id: Ia0de9ac66ad2137c6d1147e2ad5c899ab7b33ece
2019-03-25 23:54:01 -07:00
Junyu Lai
67cfb00800 Merge "Reveal the call trace of failed test cases which run in executors" 2019-03-26 06:38:39 +00:00
Remi NGUYEN VAN
97350573b9 Merge "Add nullability annotations"
am: 539821c978

Change-Id: I47ec92d406b16eaff049ad4a5af1b1b407418e4d
2019-03-25 06:33:40 -07:00
Mark Chien
52ffa51e7f Merge "[TCPKeepalive] Fill correct TOS and TTL value"
am: 13cc9e442e

Change-Id: I8c5993aadd1bfa79290821215f6dae2bba057c5f
2019-03-25 06:25:42 -07:00
Treehugger Robot
539821c978 Merge "Add nullability annotations" 2019-03-25 13:19:19 +00:00
Mark Chien
13cc9e442e Merge "[TCPKeepalive] Fill correct TOS and TTL value" 2019-03-25 13:10:17 +00:00
junyulai
c3106feee7 Reveal the call trace of failed test cases which run in executors
Currently, the fails in testTcpSocketKeepalives are triggered by
fail() inside the executor, which is hiding the actual call trace
but only message remains. And it made the fail case hard to
debug.

So this commit is to bubble up the Exception by using a custom
functional interface.

Bug: 123987272
Test: 1. atest FrameworksNetTests
      2. manually fail the test case and see the call trace

Change-Id: I125e673938a5e9d1de86f83c1a732227a4bd3207
2019-03-25 12:56:47 +00:00
Junyu Lai
7246f1a563 Merge "Fix SocketKeepalive APIs which do not meet API review requirement"
am: 66bc22760a

Change-Id: Id82be12a54e676c4ad18900ae910e6d08079e62c
2019-03-25 03:57:32 -07:00
Junyu Lai
66bc22760a Merge "Fix SocketKeepalive APIs which do not meet API review requirement" 2019-03-25 10:42:37 +00:00
junyulai
7e06ad4ce9 Fix SocketKeepalive APIs which do not meet API review requirement
Per API review, change the use of FileDescriptor to
ParcelFileDescriptor.
This change also fix nullability according to API review
feedbacks.

Fix: 126698610
Fix: 126699425
Fix: 126699232
Fix: 126700278

Test: 1. m -j
      2. atest FrameworksNetTests --generate-new-metrics 50
      3. m -j doc-comment-check-docs
Change-Id: I19476c50dd1ca290bf3f41973829da2bd229796a
2019-03-25 15:56:35 +08:00
Remi NGUYEN VAN
be381ab943 Add nullability annotations
Add nullability annotations on the following methods:
 - StaticIpConfiguration#getRoutes
 - ValidationProbeEvent#getProbeName

Test: m
Bug: 128935825
Change-Id: I1c17d200f3125e684c4e4d67b2f7f079eda310b6
2019-03-25 16:46:34 +09:00
markchien
b5a2b8076a [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
afa7a43b17 Merge "Separate NetworkMonitor/framework portal URL"
am: 8ab472e77a

Change-Id: I1926527f7875e459b4d3c84bfcd8b3aac9562cae
2019-03-24 20:02:39 -07:00
Remi NGUYEN VAN
8ab472e77a Merge "Separate NetworkMonitor/framework portal URL" 2019-03-25 02:50:37 +00:00
Remi NGUYEN VAN
648de2131b Merge "Fix API in CaptivePortal and ConnectivityManager"
am: 8f4c739827

Change-Id: I4cc3c61232c74bafe4eb549c1aba5de20a8bb3ff
2019-03-24 19:46:32 -07:00
Treehugger Robot
8f4c739827 Merge "Fix API in CaptivePortal and ConnectivityManager" 2019-03-25 02:37:28 +00:00
Remi NGUYEN VAN
1fb7cabbfc Fix API in CaptivePortal and ConnectivityManager
- Remove CaptivePortal constructor from SystemApi. This constructor was
   added in Q timeframe and ends up being unnecessary since
   CaptivePortal creation was refactored to ConnectivityService because
   of visibility issues on ICaptivePortal.
 - Rename getAvoidBadWifi to shouldAvoidBadWifi
 - Add permission annotation for shouldAvoidBadWifi

(already merged in internal as:
I09545c00af3519dbf141dd5951b28f49e37b3e80)

Test: flashed, WiFi and captive portal works
Bug: 128935314
Bug: 128935673
Merged-In: I09545c00af3519dbf141dd5951b28f49e37b3e80
Change-Id: I7395d4a4db6a64398a827692aee1956c011873e5
2019-03-25 01:43:48 +00:00
Remi NGUYEN VAN
035f65367b 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
Lucas Lin
5bda6d7efc Merge "Enable PARTIAL_CONNECTIVITY dialog"
am: 07461c335b

Change-Id: I88ca44ef0c0a7cf48538421022d0fed10d15fc26
2019-03-21 21:30:48 -07:00
Lucas Lin
07461c335b Merge "Enable PARTIAL_CONNECTIVITY dialog" 2019-03-22 04:17:43 +00:00
Luke Huang
697b5a4aab Merge "Support query cancellation for async DNS API"
am: 6aea92f594

Change-Id: I400d98e13cf36ca16c3743eddee96bfae4b47b5c
2019-03-21 20:50:18 -07:00
Luke Huang
6aea92f594 Merge "Support query cancellation for async DNS API" 2019-03-22 03:26:21 +00:00
lucaslin
e0118abc5b Enable PARTIAL_CONNECTIVITY dialog
Enable PARTIAL_CONNECTIVITY dialog to complete the function.

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: I5c9fe7a898d30d2f7f75142c85e73fefc257a147
2019-03-22 09:10:08 +08:00
Paul Hu
f1f3b08982 Merge "Fix Automated API Review issues."
am: acb5eca325

Change-Id: I9c007c129269a80d9aede31c8980dbd42e9f1f84
2019-03-21 10:46:03 -07:00
Paul Hu
acb5eca325 Merge "Fix Automated API Review issues." 2019-03-21 17:19:26 +00:00
lucaslin
d7a9e6da54 Merge "Temporarily disable flaky test."
am: a7f5cf3adb

Change-Id: I3f2f81a6884ba1ffc212c4da393846a597af831b
2019-03-21 08:19:47 -07:00
Treehugger Robot
a7f5cf3adb Merge "Temporarily disable flaky test." 2019-03-21 15:04:15 +00:00
Paul Hu
9a9dac2b98 Merge "Fix Automated API Review issues."
am: a793b48cf0

Change-Id: I9cbe7dc166ec066b8785553f31dc32ea0572be8e
2019-03-21 07:24:16 -07:00
Paul Hu
a793b48cf0 Merge "Fix Automated API Review issues." 2019-03-21 14:11:36 +00:00
Mark Chien
bee0fa077b Merge "Replace TcpSocketInfo with similar structure"
am: a460377cf9

Change-Id: I6e3f89a910fc3ab7524da1c5c5b525a72191a4ed
2019-03-21 05:14:45 -07:00
Mark Chien
a460377cf9 Merge "Replace TcpSocketInfo with similar structure" 2019-03-21 12:02:54 +00:00
lucaslin
3bc80ae915 Temporarily disable flaky test.
Test: None
Bug: 128426024
Change-Id: I6fa12e50decbafe9d934030865c5a8f20d42b86f
2019-03-21 19:14:32 +08:00
Mark Chien
0c27d50a2a Merge "Restrict scope of switch Repair Mode"
am: 19b1610698

Change-Id: Ie655ad82d0441aa6ad6fc45a6e63dc2a53338148
2019-03-21 00:18:11 -07:00