Commit Graph

6839 Commits

Author SHA1 Message Date
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
b8368cc806 Merge "Reveal the call trace of failed test cases which run in executors" am: 67cfb00800 am: ff5f8defa6
am: e674483e9f

Change-Id: I023c8140c94966479db7f12647838699324462af
2019-03-26 00:13:47 -07:00
Junyu Lai
e674483e9f Merge "Reveal the call trace of failed test cases which run in executors" am: 67cfb00800
am: ff5f8defa6

Change-Id: I1a2d312842f33a9b7b98da925b332becaece3cb2
2019-03-26 00:03:27 -07: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
e289064a7b Merge "Add nullability annotations" am: 539821c978 am: 97350573b9
am: c66eb1e12e

Change-Id: I43088399da1d81556ab903ef1ca716439129f00d
2019-03-25 06:56:43 -07:00
Mark Chien
f2a195cad0 Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: 13cc9e442e am: 52ffa51e7f
am: 73062f4600

Change-Id: I80c56a14a0be2e6b7996f2bcb9a1a320f0c2c058
2019-03-25 06:44:17 -07:00
Remi NGUYEN VAN
c66eb1e12e Merge "Add nullability annotations" am: 539821c978
am: 97350573b9

Change-Id: Ic81850c2976e7412e85856c5d1336f30d0691125
2019-03-25 06:42:49 -07:00
Mark Chien
73062f4600 Merge "[TCPKeepalive] Fill correct TOS and TTL value" am: 13cc9e442e
am: 52ffa51e7f

Change-Id: I0de6ff4a97f64b0ba72856c9d9d6fe57d677e5fa
2019-03-25 06:34:45 -07: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
40ad433f92 Merge "Fix SocketKeepalive APIs which do not meet API review requirement" am: 66bc22760a am: 7246f1a563
am: 0f69af35db

Change-Id: I873a82de90efce6f3baa17761c0576dc9c8210be
2019-03-25 04:16:18 -07:00
Junyu Lai
0f69af35db Merge "Fix SocketKeepalive APIs which do not meet API review requirement" am: 66bc22760a
am: 7246f1a563

Change-Id: Iead39e877aec917ff3c409fda1ff0c4dbaa21fcb
2019-03-25 04:06:39 -07: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
Remi NGUYEN VAN
fa062e4857 Merge "Separate NetworkMonitor/framework portal URL" am: 8ab472e77a am: afa7a43b17
am: 0fabd5dca2

Change-Id: I85e744d94d96ecf9ac558e62016418d8199bb98c
2019-03-24 20:23:39 -07: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
0fabd5dca2 Merge "Separate NetworkMonitor/framework portal URL" am: 8ab472e77a
am: afa7a43b17

Change-Id: Ic6c16ccf98e943b7003524f6e2b98e100e543221
2019-03-24 20:11:49 -07:00
Remi NGUYEN VAN
d1bd2f18e0 [automerger skipped] Merge "Fix API in CaptivePortal and ConnectivityManager" am: 8f4c739827 am: 648de2131b
am: c8acc61655 -s ours
am skip reason: change_id I09545c00af3519dbf141dd5951b28f49e37b3e80 with SHA1 d6d5505edf is in history

Change-Id: I793a60492ba7b63c6dea2937e7fc651a1ab617b9
2019-03-24 20:10:38 -07: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
c8acc61655 Merge "Fix API in CaptivePortal and ConnectivityManager" am: 8f4c739827
am: 648de2131b

Change-Id: Ibe9d16bbf1e794eb05166ad9c6bccb3ad5bcae9d
2019-03-24 19:57:01 -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
Varun Anand
a611794dac [automerger skipped] Merge "Revert "Revert "Update VPN capabilities when its underlying network set is null.""" into pi-dev am: 376b30f985 -s ours
am: 816e3114eb -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: Ibe57fcb06756943987e70b7e38e57a07f71de4e6
2019-03-22 12:37:54 -07:00
Varun Anand
347a040c66 [automerger skipped] Revert "Revert "Update VPN capabilities when its underlying network set is null."" am: bf1d84cc4e -s ours
am: 96b3daacc9 -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: I020ffc31fb0ef41332df37110bb0a8b01e76c976
2019-03-22 12:06:23 -07:00
Varun Anand
816e3114eb [automerger skipped] Merge "Revert "Revert "Update VPN capabilities when its underlying network set is null.""" into pi-dev
am: 376b30f985 -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: I0634f41f9b3be7cc640b31ab3067708f99759831
2019-03-22 12:02:13 -07:00
Varun Anand
dd9a68abc8 [automerger skipped] Merge "Remove ConnectivityManager and its usages from NetworkStatsService." into pi-dev am: 182784fea4 -s ours
am: d9801eced8 -s ours
am skip reason: change_id I57e117bb4e9efe491b19d6b5a479f2d58d1c58e6 with SHA1 45406bff69 is in history

Change-Id: I34c36c55ba985118ffc2210b2e05daab2a0ea8e8
2019-03-22 12:02:12 -07:00
Varun Anand
96b3daacc9 [automerger skipped] Revert "Revert "Update VPN capabilities when its underlying network set is null.""
am: bf1d84cc4e -s ours
am skip reason: change_id Id0abc4d304bb096e92479a118168690ccce634ed with SHA1 df56995870 is in history

Change-Id: I98242257e569eeac747c0328dfa6381e49e7c0b0
2019-03-22 11:45:16 -07:00
Varun Anand
d9801eced8 [automerger skipped] Merge "Remove ConnectivityManager and its usages from NetworkStatsService." into pi-dev
am: 182784fea4 -s ours
am skip reason: SHA1 182784fea4 skipped by user vaanand

Change-Id: Ieee5f28f6d10b0d2b8a7b3eb0272297f148ef03f
2019-03-22 11:39:41 -07:00
Lorenzo Colitti
0eabf54862 Merge "Fix API in CaptivePortal and ConnectivityManager" 2019-03-22 11:46:21 +00:00
Lucas Lin
c78847af69 Merge "Enable PARTIAL_CONNECTIVITY dialog" am: 07461c335b am: 5bda6d7efc
am: c8487a7265

Change-Id: I2ba8244fe582c4194f9d2a60d9562b12d5c8e431
2019-03-22 03:50:47 -07:00
Luke Huang
63c28c2c1c Merge "Support query cancellation for async DNS API" am: 6aea92f594 am: 697b5a4aab
am: 7bc21f13af

Change-Id: I034361541f64c10d72474beaefdb3547c9c2733e
2019-03-22 03:35:57 -07:00
Remi NGUYEN VAN
d6d5505edf 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

Test: flashed, WiFi and captive portal works
Bug: 128935314
Bug: 128935673
(clean cherry-pick of AOSP I7395d4a4db6a64398a827692aee1956c011873e5)

Change-Id: I09545c00af3519dbf141dd5951b28f49e37b3e80
2019-03-22 17:16:52 +09: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
c8487a7265 Merge "Enable PARTIAL_CONNECTIVITY dialog" am: 07461c335b
am: 5bda6d7efc

Change-Id: I2e1947cdf6e084aefd4d2ccd7b345df79c62e383
2019-03-21 21:40:39 -07: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
7bc21f13af Merge "Support query cancellation for async DNS API" am: 6aea92f594
am: 697b5a4aab

Change-Id: I890bbb94bf1b8e2242efeb5c868e289a8ae4a95d
2019-03-21 21:13:29 -07: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
2e2bc9c173 Merge "Fix Automated API Review issues." am: acb5eca325 am: f1f3b08982
am: affa3f497d

Change-Id: Iba1630161579571d4975aba9bbd5c767f82c8a98
2019-03-21 11:54:51 -07:00