Commit Graph

6354 Commits

Author SHA1 Message Date
Junyu Lai
4bfa391000 Merge changes I0baf582f,I4bba01ba am: ae26195e6a am: 92adef2970
am: 9cd8136d86

Change-Id: I2cc021899270b41e4b9047ef32869af53ea6fb65
2019-03-27 18:43:18 -07:00
Junyu Lai
9cd8136d86 Merge changes I0baf582f,I4bba01ba am: ae26195e6a
am: 92adef2970

Change-Id: Ia6cd87afec7c449b9096400352c5f6de75a012bc
2019-03-27 18:27:36 -07:00
Junyu Lai
92adef2970 Merge changes I0baf582f,I4bba01ba
am: ae26195e6a

Change-Id: Ie69a03e6c61e172ba7e9948706fe6780be61a41b
2019-03-27 18:17:27 -07:00
Junyu Lai
ae26195e6a 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
c4fb248ef7 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
Chenbo Feng
39a5680d59 Merge "Get the permission information for native services" am: 743a1c8001 am: f28abcce27
am: e9b7751ccf

Change-Id: I798cf00caee4f505d45929ddf9ccd03e658c4c3c
2019-03-26 22:53:13 -07:00
Chenbo Feng
e9b7751ccf Merge "Get the permission information for native services" am: 743a1c8001
am: f28abcce27

Change-Id: I61bdf44239c880ef1b95c31a037f64158a32d789
2019-03-26 22:42:38 -07:00
Chenbo Feng
f28abcce27 Merge "Get the permission information for native services"
am: 743a1c8001

Change-Id: I806e3e948dfab0cc8c691c20f377bbc3a24240a6
2019-03-26 22:33:27 -07:00
junyulai
04bd504641 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
8c501b7a87 Merge "Fix the INTERNET related permissions" am: 931d909f3b am: 2ccd29bb0e
am: cbf55479f0

Change-Id: Id14b54002f7b3496df9e7943a127f63dcf4e82b2
2019-03-26 20:14:10 -07:00
Chenbo Feng
cbf55479f0 Merge "Fix the INTERNET related permissions" am: 931d909f3b
am: 2ccd29bb0e

Change-Id: I7b07ca0ef7966f0ebee17cabe2eb79c5d6381228
2019-03-26 20:02:14 -07:00
Chenbo Feng
2ccd29bb0e Merge "Fix the INTERNET related permissions"
am: 931d909f3b

Change-Id: Id97b1ea945409e938158f30efd564b10c9e81380
2019-03-26 19:52:57 -07:00
Chenbo Feng
1f428ed2df 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
931d909f3b Merge "Fix the INTERNET related permissions" 2019-03-27 02:35:35 +00:00
Lucas Lin
06a19ccd6d Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity" am: 15b9eb4e43 am: 8fc2439929
am: 8c64dd081a

Change-Id: I80399f9980119342ba5cd3d4f1922badb1fee3e9
2019-03-26 19:00:50 -07:00
Lucas Lin
8c64dd081a Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity" am: 15b9eb4e43
am: 8fc2439929

Change-Id: I4b0a70cbfdce8f43c07275ace151d3ab464da5a4
2019-03-26 18:49:59 -07:00
Lucas Lin
8fc2439929 Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity"
am: 15b9eb4e43

Change-Id: I0639d4ccd7c3211595ede82bce3daa87ae759e10
2019-03-26 18:41:00 -07:00
Lucas Lin
15b9eb4e43 Merge "Fix flaky test for ConnectivityServiceTest#testPartialConnectivity" 2019-03-27 01:29:51 +00:00
Chenbo Feng
efc545bd42 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
563b751b21 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
23bf315b90 Merge "Reveal the call trace of failed test cases which run in executors" am: 43dc93b180 am: ca9b494b83
am: a71b378095

Change-Id: I023c8140c94966479db7f12647838699324462af
2019-03-26 00:13:47 -07:00
Junyu Lai
a71b378095 Merge "Reveal the call trace of failed test cases which run in executors" am: 43dc93b180
am: ca9b494b83

Change-Id: I1a2d312842f33a9b7b98da925b332becaece3cb2
2019-03-26 00:03:27 -07:00
Junyu Lai
ca9b494b83 Merge "Reveal the call trace of failed test cases which run in executors"
am: 43dc93b180

Change-Id: Ia0de9ac66ad2137c6d1147e2ad5c899ab7b33ece
2019-03-25 23:54:01 -07:00
Junyu Lai
43dc93b180 Merge "Reveal the call trace of failed test cases which run in executors" 2019-03-26 06:38:39 +00:00
Remi NGUYEN VAN
c1687b4a7a Merge "Add nullability annotations" am: 9049f8617b am: a475897492
am: ea8fce17c7

Change-Id: I43088399da1d81556ab903ef1ca716439129f00d
2019-03-25 06:56:43 -07:00
Mark Chien
de617f4a74 Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: bd1567cbae am: 493e5319f6
am: 1368554fc5

Change-Id: I80c56a14a0be2e6b7996f2bcb9a1a320f0c2c058
2019-03-25 06:44:17 -07:00
Remi NGUYEN VAN
ea8fce17c7 Merge "Add nullability annotations" am: 9049f8617b
am: a475897492

Change-Id: Ic81850c2976e7412e85856c5d1336f30d0691125
2019-03-25 06:42:49 -07:00
Mark Chien
1368554fc5 Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: bd1567cbae
am: 493e5319f6

Change-Id: I0de6ff4a97f64b0ba72856c9d9d6fe57d677e5fa
2019-03-25 06:34:45 -07:00
Remi NGUYEN VAN
a475897492 Merge "Add nullability annotations"
am: 9049f8617b

Change-Id: I47ec92d406b16eaff049ad4a5af1b1b407418e4d
2019-03-25 06:33:40 -07:00
Mark Chien
493e5319f6 Merge "[TCPKeepalive] Fill correct TOS and TTL value"
am: bd1567cbae

Change-Id: I8c5993aadd1bfa79290821215f6dae2bba057c5f
2019-03-25 06:25:42 -07:00
Treehugger Robot
9049f8617b Merge "Add nullability annotations" 2019-03-25 13:19:19 +00:00
Mark Chien
bd1567cbae Merge "[TCPKeepalive] Fill correct TOS and TTL value" 2019-03-25 13:10:17 +00:00
junyulai
b454b0fc0e 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
639ba7742d Merge "Fix SocketKeepalive APIs which do not meet API review requirement" am: 5fdd1748fa am: b7ed180e64
am: 7f8cfa3536

Change-Id: I873a82de90efce6f3baa17761c0576dc9c8210be
2019-03-25 04:16:18 -07:00
Junyu Lai
7f8cfa3536 Merge "Fix SocketKeepalive APIs which do not meet API review requirement" am: 5fdd1748fa
am: b7ed180e64

Change-Id: Iead39e877aec917ff3c409fda1ff0c4dbaa21fcb
2019-03-25 04:06:39 -07:00
Junyu Lai
b7ed180e64 Merge "Fix SocketKeepalive APIs which do not meet API review requirement"
am: 5fdd1748fa

Change-Id: Id82be12a54e676c4ad18900ae910e6d08079e62c
2019-03-25 03:57:32 -07:00
Junyu Lai
5fdd1748fa Merge "Fix SocketKeepalive APIs which do not meet API review requirement" 2019-03-25 10:42:37 +00:00
junyulai
6114378ad2 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
e04dfba3cf 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
Remi NGUYEN VAN
b74f6131c1 Merge "Separate NetworkMonitor/framework portal URL" am: 391c40841f am: a988825101
am: cba999788a

Change-Id: I85e744d94d96ecf9ac558e62016418d8199bb98c
2019-03-24 20:23:39 -07:00
markchien
d2c678b32f [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
cba999788a Merge "Separate NetworkMonitor/framework portal URL" am: 391c40841f
am: a988825101

Change-Id: Ic6c16ccf98e943b7003524f6e2b98e100e543221
2019-03-24 20:11:49 -07:00
Remi NGUYEN VAN
79c7c7b6b9 [automerger skipped] Merge "Fix API in CaptivePortal and ConnectivityManager" am: 998e6ea285 am: e380d9ce11
am: 2dcb145bbe -s ours
am skip reason: change_id I09545c00af3519dbf141dd5951b28f49e37b3e80 with SHA1 65c187466b is in history

Change-Id: I793a60492ba7b63c6dea2937e7fc651a1ab617b9
2019-03-24 20:10:38 -07:00
Remi NGUYEN VAN
a988825101 Merge "Separate NetworkMonitor/framework portal URL"
am: 391c40841f

Change-Id: I1926527f7875e459b4d3c84bfcd8b3aac9562cae
2019-03-24 20:02:39 -07:00
Remi NGUYEN VAN
2dcb145bbe Merge "Fix API in CaptivePortal and ConnectivityManager" am: 998e6ea285
am: e380d9ce11

Change-Id: Ibe9d16bbf1e794eb05166ad9c6bccb3ad5bcae9d
2019-03-24 19:57:01 -07:00
Remi NGUYEN VAN
391c40841f Merge "Separate NetworkMonitor/framework portal URL" 2019-03-25 02:50:37 +00:00
Remi NGUYEN VAN
e380d9ce11 Merge "Fix API in CaptivePortal and ConnectivityManager"
am: 998e6ea285

Change-Id: I4cc3c61232c74bafe4eb549c1aba5de20a8bb3ff
2019-03-24 19:46:32 -07:00
Treehugger Robot
998e6ea285 Merge "Fix API in CaptivePortal and ConnectivityManager" 2019-03-25 02:37:28 +00:00
Remi NGUYEN VAN
338eb2a1ec 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
Varun Anand
0c17614d41 [automerger skipped] Merge "Revert "Revert "Update VPN capabilities when its underlying network set is null.""" into pi-dev am: dea6865011 -s ours
am: d3e6645e75 -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 273f900b3b is in history

Change-Id: Ibe57fcb06756943987e70b7e38e57a07f71de4e6
2019-03-22 12:37:54 -07:00