Commit Graph

6177 Commits

Author SHA1 Message Date
Chalard Jean
a070aaa88f Remove the <= P restriction for WIFI_P2P
This is still sent in an intent.

Bug: 975059
Change-Id: I56c86b0c1912064d5a642991df32d2cefb6a8d5b
2019-06-17 19:46:34 +09:00
Treehugger Robot
c687700cde Merge "Change factoryReset to succeed for Settings" 2019-06-14 07:02:17 +00:00
Heemin Seog
db8489dc29 Change factoryReset to succeed for Settings
Wrap a part of factoryReset with Binder.withCleanCallingIdentity() so
that it doesn't crash thinking that a different uid connected to the
network stack.

Test: build, manual
Change-Id: Iea246a4c1939a4e7e35434137051835ece81d92f
2019-06-13 09:30:19 -07:00
Chiachang Wang
fbb97ab240 Merge "Suppress the wtf log for notifications that are expected" 2019-06-13 09:15:09 +00:00
Chiachang Wang
5e8a49cf1f Suppress the wtf log for notifications that are expected
PARTIAL and NO_INTERNET may happen in the real world for
those transport types that provide internet. These two
notification types should be reasonable notificaitons, not a
terrible failure as the log. For Q, it may be too risky to
display more notifications with other information instead of
SSID. Thus, suppress the wtf log for these two notifications.

Bug: 135043192
Test: atest FrameworksNetTests
Change-Id: I35f3718fa93b403858587d918f0bc596f6c92f3e
2019-06-13 07:55:07 +00:00
Mark Chien
fe8af96eba Merge "Fix NullPointerException in ConnectivityService" 2019-06-12 06:24:41 +00:00
Varun Anand
cec619e577 Merge changes from topic "vpn_data_accnt_revert"
* changes:
  Revert "Take all VPN underlying networks into account when migrating traffic for"
  Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
  Revert "Addressing comments for http://ag/7700679."
  Revert "Add one more test for VPN usage stats."
2019-06-12 01:05:01 +00:00
Luke Huang
7c98ae7d01 Merge "Fix race condition caused by fd reused for DnsResolver" 2019-06-11 15:32:17 +00:00
Luke Huang
6c8b770a98 Fix race condition caused by fd reused for DnsResolver
There might be a gap between fd close and fd event listener unregister.
If fd is reused for another query during that gap, it might cause the
query failed with no response since addOnFileDescriptorEventListener
method failed. To fix this problem, we must ensure that fd event
listener is unregistered before fd closing.

Bug: 134310704
Test: atest DnsResolverTest
Change-Id: Ifb6bd34dc54dcf1c61fe8b87785124df4bc0f410
2019-06-11 15:18:28 +08:00
Varun Anand
048c1c6c32 Revert "Take all VPN underlying networks into account when migrating traffic for"
This reverts commit 612520f544.

Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752.

Bug: 134244752
Change-Id: I2f1839d7776a613ca571af8a542755ddc5fc8760
Merged-In: Ibdaad3a4cbf0d8ef1ed53cfab1e454b9b878bae9
2019-06-10 16:00:48 -07:00
Varun Anand
fb0e689ea5 Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
This reverts commit 2af0b66aba.

Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752.

Bug: 134244752
Change-Id: I37f75c2b243ea548a88ef1dae88287405c6ef55f
Merged-In: I0c00e8f0e30cee987b71b561079a97bf09d4dae4
2019-06-10 16:00:38 -07:00
Varun Anand
5701cc30bb Revert "Addressing comments for http://ag/7700679."
This reverts commit 4d83f3e073.

Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752.

Bug: 134244752
Change-Id: I12ab724e2ef8a5c1b42078330ba74713ff86fdd1
Merged-In: I5fbb3443a39a21fc9d96442726cd10d20e8d61cd
2019-06-10 16:00:28 -07:00
Varun Anand
5cc78a32d6 Revert "Add one more test for VPN usage stats."
This reverts commit 635b441ff9.

Reason for revert: This change has been implicated in 4-way deadlocks as seen in b/134244752.

Bug: 134244752
Change-Id: I87ddc0af9ff6fbd9b7afd6d4d24985b9b7205416
Merged-In: I64b48d575f2e6ec4cb7d2d100a859a30af0501dc
2019-06-10 15:59:58 -07:00
Lorenzo Colitti
b1057f505a Merge "Don't use a high-priority notification on auto-join." 2019-06-07 08:26:38 +00:00
Lorenzo Colitti
8a2348f222 Don't use a high-priority notification on auto-join.
If the device connects to a network automatically and not through
user action, a high-priority notification is intrusive and is
inconsistent with other networking notifications, which are
usually only high priority if the network is manually selected.

Bug: 130766237
Test: see next CL in patch series
Change-Id: I8824f2d1a0efeb6cb75e430ef5159ebce0018779
2019-06-07 12:53:30 +09:00
Lorenzo Colitti
98f9af3d1f Merge "Always prompt for limited connectivity." 2019-06-06 04:28:53 +00:00
Lorenzo Colitti
2fca94fe48 Always prompt for limited connectivity.
Bug: 130766237
Test: See subsequent CL in same patch series.
Change-Id: I45b4a7ba2e21c0be868939d8c7bb78891d69c48b
2019-06-06 11:59:49 +09:00
Lorenzo Colitti
c8b4342998 Merge "Allow passing in acceptUnvalidated without explicitlySelected" 2019-06-05 05:00:14 +00:00
Lorenzo Colitti
b882c54945 Allow passing in acceptUnvalidated without explicitlySelected
This will allow wifi to tell ConnectivityService that partial
connectivity is acceptable even if the network is not explicitly
selected.

This is needed when the user selects a partial connectivity
network and tells the system to connect to the network, and never
to ask again. In such cases, the system must switch to the
network even if it is not explicitly selected.

Bug: 130766237
Test: atest FrameworksNetTests
Test: unit tests in an upcoming CL
Change-Id: I13465090b7b1c0bf5dc83362387a5428d77b7e1d
Merged-In: I13465090b7b1c0bf5dc83362387a5428d77b7e1d
(cherry picked from commit e01696a4c4)
2019-06-05 11:12:18 +09:00
Treehugger Robot
4a59f15464 Merge "Fix cannot create Nat-T keepalive on mobile data" 2019-06-04 12:09:00 +00:00
junyulai
88da121dfe Fix cannot create Nat-T keepalive on mobile data
Currently phone process fail to unparcel NattKeepalivePacketData
since it is not in framework. Moves NattKeepalivePacketData to
framework to make it can be utilized by telephony.

This change also removes the error feedback triggered by calling
add keepalive packet filter to an unsupported network agent. This
is misinterpreted by KeepaliveTracker that start keepalive is
failing.

Bug: 134048171
Test: 1. atest android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitTelephony
      2. atest android.net.cts.ConnectivityManagerTest
      3. atest FrameworksNetTests
      4. atest FrameworksTelephonyTests
Change-Id: If630d5b339aa722717258c721daa8ead8c431e2d
2019-06-04 18:22:15 +08:00
Lorenzo Colitti
94851761a8 Merge "Re-notify if the network goes to PARTIAL." 2019-06-03 12:50:11 +00:00
Chiachang Wang
61e494012d Re-notify if the network goes to PARTIAL.
If NetworkMonitor detects partial connectivity before
EVENT_PROMPT_UNVALIDATED arrives, show the partial
connectivity notification immediately. Re-notify
partial connectivity silently if no internet
notification already there.

Bug: 130683832
Bug: 130766237
Test: atest com.android.server.ConnectivityServiceTest
Change-Id: I7d4eddc643ec795c3961097dc1bdd314d168f6c7
2019-06-03 12:49:53 +00:00
soma, kawata
29444ae336 Fix NullPointerException in ConnectivityService
[Problem]
NullPointerException occurs in ConnectivityService when boot up.

[Root Cause]
When ConnectivityService starts up, isTetheringSupported may access
UserManager that has not been created yet. Therefore,
NullPointerException occurs.

[Solution]
Changed to create UserManager before makeTethering().

Bug: 134351774
Test: ConnectivityServiceTest
Change-Id: I299ecfa6af7295c1f3922f37d90eb5d3ab0d0286
2019-06-03 16:38:27 +09:00
Lorenzo Colitti
6edf86cd9c Don't crash ConnectivityService if the network stack crashes.
When the network stack crashes, the system will rebind to it.
Existing references are no longer useful (they just throw
RemoteException) but if the system is still up, then the user
can at least recover the situation by taking actions such as
going into airplane mode, toggling wifi, etc.

This CL stops ConnectivityService from crashing the system when
it cannot talk to NetworkMonitor. This is arguably better than
crashing the system, because crashing the system is disruptive
and carries the serious risk of a bootloop from which it is not
possible to recover.

NetworkStackClient already contains code to crash the system
when the network stack crashes. This change help ensure that
if a crash occurs, it is the result of an explicit decision by
that code instead of an unchecked exception in one of the callers
of the network stack.

Bug: 133725814
Test: builds, boots
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ib9a15fececd8579fc5b139fe0341275a45512e0f
2019-05-31 19:30:36 +09:00
Lorenzo Colitti
635b441ff9 Add one more test for VPN usage stats.
(cherry picked from commit 20204cdf6a)

Covers the case where the majority of traffic through the VPN is
caused by the VPN app itself, and ensures that that traffic is
correctly attributed to the VPN app as opposed to spread between
the other apps that use the VPN.

Bug: 120145746
Test: atest NetworkStatsServiceTest
Change-Id: Ibd7646dc088fa4180abd696e89c3148ff34ce190
Merged-In: Iffd3f95fc2e11d311691a797b010edb38d2ef3c6
2019-05-30 15:59:28 +00:00
Varun Anand
4d83f3e073 Addressing comments for http://ag/7700679.
(cherry picked from commit 78d5ac4f8f)

Note, that its in a separate CL so we could cherry-pick this CL to aosp.
http://ag/7700679 is already in aosp (http://aosp/865073).

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests

Change-Id: Ic1767bc8bf1460e4223f86465fc72344428e6055
Merged-In: I7cfda226b4ed11b67002b83b38fba0f5caf96718
2019-05-30 15:59:07 +00:00
Luke Huang
7edc776afc Merge "Fix issue for DnsResolver#query" 2019-05-30 11:22:50 +00:00
Chiachang Wang
d5895ce4cf Merge "Replace limited connectivity notification after detecting it" 2019-05-30 10:56:08 +00:00
Treehugger Robot
baaef39c9b Merge "Prevent a 4-way binder interlock leading to a leak." 2019-05-30 10:22:30 +00:00
Chalard Jean
8690e1f144 Merge "Always give VPN the INTERNET capability." 2019-05-30 08:36:19 +00:00
Chiachang Wang
af13b9f275 Replace limited connectivity notification after detecting it
No internet notification may be prompted before partial
connectivity being detected. Partial connectivity status will
be set into NAI and prompted in the Setting. Behavior is not
aligned between Setting and notification. Thus, update
notification again if partial connectivity is detected.
Also, sliently show the updated notification if no internet
notification has already been shown to user to prevent alerting
user in short time.

Bug: 130683832
Test: Verified with simulated partial connectivity
Test: atest FrameworksNetTests
Change-Id: Ie16a8ce6e0fa437048e8c1eea240314ca30e9520
2019-05-30 16:19:47 +08:00
Chalard Jean
7284daa96e Prevent a 4-way binder interlock leading to a leak.
System server             |        NetworkStack
                              |
NetworkMonitorCallbacks  ←----|--- NetworkMonitorCallbacks$Stub$Proxy
         ↓                    |           ↑
  NetworkAgentInfo            |      NetworkMonitor
         ↓                    |           ↑
NetworkMonitor$Stub$Proxy ----|---→ NetworkMonitorImpl

Bug: b/133174607
Test: Manual. The simplest artifact is observed by watching the output of
adb shell dumpsys meminfo -d com.android.networkstack | grep 'Proxy Binders'
while connecting and disconnecting multiple times to any network.
This will display the number of binder proxies. Before this, the binder
proxy count increases by 1 with each connection and never goes down (there
is some noise, as proxy objects are sometimes created for other reasons,
and get GC'd eventually). After this, the binder proxy count is always
eventually stable at 27 + connected network count.

See the bug for the complete analysis.

Change-Id: Ide2428dab3fcd6d7cd00aa2a9fd99d6c99b815a4
2019-05-30 17:12:46 +09:00
Chalard Jean
318feaf1ed Always give VPN the INTERNET capability.
Split-tunnel VPN (which are the only ones affected by this change)
always fall through to the default network for routes they don't
handle, and even if the underlying network(s) don't provide access
this may be a pinhole that can actually reach the broader network.

In practice this behaves like the original release of P and is the
safest thing to do for Q. In R we should evaluate giving the VPN
app the ability to simply tell the network stack whether it does
provide Internet access or not.

Bug: 119216095
Test: FrameworksNetTests NetworkStackTests
Change-Id: I262ca41fe0225660551c9a421562405366b6acac
2019-05-30 16:11:14 +09:00
Luke Huang
be164b2db8 Fix issue for DnsResolver#query
1. Previously, getDnsNetId doesn't handle all the cases.
Fix it with cosidering bypass private DNS flag.
2. Make getDnsNetId return Network instead of netId,
and change name from getDnsNetId to getDnsNetwork

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest
Change-Id: Ic8d45b802d72a266f9ec97bfea620c1ede6967e5
2019-05-30 06:34:03 +00:00
Chen Xu
74f0698ce6 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" 2019-05-29 17:15:41 +00:00
Chalard Jean
126a957df5 Merge "Add a common test library." 2019-05-29 12:16:08 +00:00
chen xu
d5e7114ee9 NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions
Bug: 133236378
Test: Manual
Change-Id: I49fbde1fe73b33aadcf8fd23ad224f363b137bf3
2019-05-28 23:28:56 -07:00
Luke Huang
3b14d4641a Minor changes for DnsUtils and its test
fix nits for ag/7671031

Bug: 129530368
Test: atest DnsUtilsTest
Change-Id: I562d33870a933a5fe55c89137a2d9574e3c59b90
2019-05-29 13:56:27 +08:00
Chalard Jean
e343bcc913 Add a common test library.
This is the most common test library for Connectivity tests. It is
meant to be usable in framework tests, network stack tests, CTS,
GTS. To achieve that, it can only depend on framework classes.

Bug: none
Test: NetworkMonitorTest
Test: NsdManagerTest
Test: ConnectivityServiceTest
Test: OffloadControllerTest
Test: NetworkStatsObserversTest
Test: NetworkStatsServiceTest
(all the touched classes)

Change-Id: Ic47cbe7ba0e407145fa6bc49bb2adb3c5937dbc4
2019-05-28 22:20:51 +09:00
Chalard Jean
ce2f2fe2e8 Merge "Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS." 2019-05-28 12:26:10 +00:00
Xiao Ma
5ad000a641 Merge "Wipe the data in IpMemoryStore database upon network factory reset." 2019-05-28 00:52:00 +00:00
Luke Huang
ac6c768bd6 Merge "Remove broken test testRfc6724Sort" 2019-05-27 14:12:05 +00:00
Treehugger Robot
c73af87b45 Merge "Reinstate access to a forgotten member" 2019-05-27 11:14:37 +00:00
Luke Huang
179c33f322 Remove broken test testRfc6724Sort
This test is conitnuely fail in cuttlefish.
Lack of ipv6 default route in cuttlefish caused the test failed.
The reason is that the result of rfc6724Sort depends on on the route in system.
It is not good to expect any route should exists, so remove it.

Bug: 133649648
Test: atest DnsUtilsTest
Change-Id: I91f89782b9b989fa1a49e666bb5ce2df3a0dbbf7
2019-05-27 17:49:32 +08:00
Chalard Jean
b807dd8884 Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS.
Also :
- Fix testUidFilteringDuringVpnConnectDisconnectAndUidUpdates that
  was failing on devices with a first released SDK >= Q
- Add a test actually tests that the system has the permission, as
  the test was only testing what's in the mock

Bug: 119770201
Test: New test making sure this stays true
Change-Id: I74cf5f0fa17fcf818f1fed78c7e3e4375c20152e
2019-05-27 16:35:22 +09:00
Xiao Ma
555e408928 Wipe the data in IpMemoryStore database upon network factory reset.
Bug:128499160
Test: manual
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ib563463a861a5d27b1e9b5fbb92342249b573802
2019-05-27 15:05:09 +09:00
Chiachang Wang
b8d3727aa1 Clean up for multiple validation result update
This is a follow-up commit for aosp/955431 to update commets
and minor updates in unit test.

Test: atest com.android.server.ConnectivityServiceTest#testCaptivePortalOnPartialConnectivity
Bug: 130683832
Change-Id: I581eae8daeddd2c4c186e7b40e27fef2aaa7ab43
2019-05-24 03:29:56 +00:00
Chiachang Wang
5af07137d7 Merge "Update multiple validation result to ConnectivityService" 2019-05-24 02:50:54 +00:00
Treehugger Robot
dcc6ebb96f Merge "Fix the internet permission for native services" 2019-05-23 18:40:42 +00:00