Commit Graph

7161 Commits

Author SHA1 Message Date
Chalard Jean
3ef609ba29 Merge "[automerger skipped] Merge "Always give VPN the INTERNET capability." into qt-dev am: bc16cf3d72 -s ours am: c7028a4757 -s ours
am: 92df460a31 -s ours
am skip reason: change_id I262ca41fe0225660551c9a421562405366b6acac with SHA1 318feaf1ed is in history

Change-Id: I1f97dc9d291b6b65b4562b9288862da124023dea
2019-05-30 09:46:02 -07:00
Chalard Jean
5e79065a1e [automerger skipped] Merge "Always give VPN the INTERNET capability." into qt-dev am: bc16cf3d72 am: 053f8b300e -s ours
am: 0f81c6675d -s ours
am skip reason: change_id I262ca41fe0225660551c9a421562405366b6acac with SHA1 318feaf1ed is in history

Change-Id: I8c7be91223f840cca4a252b091c65ef4a34db144
2019-05-30 09:41:09 -07:00
Chalard Jean
aa668b9198 [automerger skipped] Merge "Always give VPN the INTERNET capability." into qt-dev am: bc16cf3d72 -s ours
am: c7028a4757 -s ours
am skip reason: change_id I262ca41fe0225660551c9a421562405366b6acac with SHA1 318feaf1ed is in history

Change-Id: I6ab350671e08b74e5c181866f819607d0c2078f3
2019-05-30 09:32:59 -07:00
Chalard Jean
0f81c6675d [automerger skipped] Merge "Always give VPN the INTERNET capability." into qt-dev am: bc16cf3d72
am: 053f8b300e -s ours
am skip reason: change_id I262ca41fe0225660551c9a421562405366b6acac with SHA1 318feaf1ed is in history

Change-Id: I11d02ceddf42a5102d7d45ec9b986c6e68e235ab
2019-05-30 09:30:44 -07:00
Chalard Jean
c7028a4757 [automerger skipped] Merge "Always give VPN the INTERNET capability." into qt-dev
am: bc16cf3d72 -s ours
am skip reason: change_id I262ca41fe0225660551c9a421562405366b6acac with SHA1 318feaf1ed is in history

Change-Id: I367d5afaa5ee254064d61f7f807af838b37583fe
2019-05-30 09:15:23 -07:00
Luke Huang
0c60cd9d94 Merge "Fix issue for DnsResolver#query" am: 7edc776afc am: da47327520 am: 36fecce5a1
am: 495f11f81b

Change-Id: Ibb5080acd3c296650d56532fc7da525e9fa95e8f
2019-05-30 04:46:40 -07:00
Luke Huang
495f11f81b Merge "Fix issue for DnsResolver#query" am: 7edc776afc am: da47327520
am: 36fecce5a1

Change-Id: I1e9fac6c64a80019c4dee1969cd316202f74ac51
2019-05-30 04:41:18 -07:00
Luke Huang
36fecce5a1 Merge "Fix issue for DnsResolver#query" am: 7edc776afc
am: da47327520

Change-Id: I819fa9eb0abab64951fdb8adb7b1fc660544a1ad
2019-05-30 04:36:42 -07:00
Luke Huang
7edc776afc Merge "Fix issue for DnsResolver#query" 2019-05-30 11:22:50 +00:00
Chiachang Wang
fedfbb39b7 Merge "Replace limited connectivity notification after detecting it" am: d5895ce4cf am: 7cfc1d4ec6 am: 66cc78d6ab
am: c39b238f3a

Change-Id: I14385a39d99a45c4a6a50a665f456f589c2f4da3
2019-05-30 04:20:49 -07:00
Chiachang Wang
c39b238f3a Merge "Replace limited connectivity notification after detecting it" am: d5895ce4cf am: 7cfc1d4ec6
am: 66cc78d6ab

Change-Id: I155464b3467f32fcf98053b47787783c3988ef6d
2019-05-30 04:15:42 -07:00
Chiachang Wang
66cc78d6ab Merge "Replace limited connectivity notification after detecting it" am: d5895ce4cf
am: 7cfc1d4ec6

Change-Id: I004e78a33689e2208918d4316bcf9a8f50a0bac3
2019-05-30 04:10:30 -07:00
Chiachang Wang
d5895ce4cf Merge "Replace limited connectivity notification after detecting it" 2019-05-30 10:56:08 +00:00
Chalard Jean
647e5b777e Merge "Prevent a 4-way binder interlock leading to a leak." am: baaef39c9b am: 88cf9c532e am: dfbdf219ee
am: 7e594c23dd

Change-Id: I6b74cf12bdbc72c0593d2a4d6f39c895d1ef3534
2019-05-30 03:50:19 -07:00
Chalard Jean
7e594c23dd Merge "Prevent a 4-way binder interlock leading to a leak." am: baaef39c9b am: 88cf9c532e
am: dfbdf219ee

Change-Id: I36e0d112194f4abf6c0aa6ea20afbc6436bf0a6e
2019-05-30 03:44:17 -07:00
Chalard Jean
dfbdf219ee Merge "Prevent a 4-way binder interlock leading to a leak." am: baaef39c9b
am: 88cf9c532e

Change-Id: Idb8659a22b9d18f1d0bc566b476f4c536c00da90
2019-05-30 03:40:37 -07: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
2e197ac1e3 Merge "Always give VPN the INTERNET capability." am: 8690e1f144 am: 6d5a4a3b1d am: f5c5c81000
am: 383f26644a

Change-Id: I57759009df3a02caa5de09668e97ca0e0603e3be
2019-05-30 02:04:30 -07:00
Chalard Jean
383f26644a Merge "Always give VPN the INTERNET capability." am: 8690e1f144 am: 6d5a4a3b1d
am: f5c5c81000

Change-Id: I49f6eca58da809b176307df8eafc778e58a77de7
2019-05-30 01:59:28 -07:00
Chalard Jean
5c7c1def90 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
Merged-In: I262ca41fe0225660551c9a421562405366b6acac
(cherry picked from commit 6d5a4a3b1d1c69eb8a542fecf5e8a306822c19b7)
2019-05-30 08:54:35 +00:00
Chalard Jean
f5c5c81000 Merge "Always give VPN the INTERNET capability." am: 8690e1f144
am: 6d5a4a3b1d

Change-Id: I144939e7197deec403d6c91f83b414d357190bd4
2019-05-30 01:54:33 -07: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
bedbf8bb78 [automerger skipped] Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" into qt-dev am: a193937849 -s ours am: 43da3dd26b -s ours
am: 90558326cb -s ours
am skip reason: change_id I49fbde1fe73b33aadcf8fd23ad224f363b137bf3 with SHA1 d5e7114ee9 is in history

Change-Id: I930ac9d00224860e9ef0149e722daea6bdc33019
2019-05-29 18:28:50 -07:00
chen xu
90558326cb [automerger skipped] Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" into qt-dev am: a193937849 -s ours
am: 43da3dd26b -s ours
am skip reason: change_id I49fbde1fe73b33aadcf8fd23ad224f363b137bf3 with SHA1 d5e7114ee9 is in history

Change-Id: I4492c9d73ffc8c8396649dfe06896f66922404ff
2019-05-29 18:22:36 -07:00
chen xu
43da3dd26b [automerger skipped] Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" into qt-dev
am: a193937849 -s ours
am skip reason: change_id I49fbde1fe73b33aadcf8fd23ad224f363b137bf3 with SHA1 d5e7114ee9 is in history

Change-Id: Icfe0c92b130b7bde5686ec8186d5df0fa16aa126
2019-05-29 18:14:18 -07:00
TreeHugger Robot
a193937849 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" into qt-dev 2019-05-30 01:00:44 +00:00
Chen Xu
48c88c5274 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" am: 74f0698ce6 am: 4d206af049 am: 7c88e8a93c
am: 26a15e9727

Change-Id: I66053706047e5b575f3e13e0701ef2e63d882574
2019-05-29 11:20:59 -07:00
Chen Xu
26a15e9727 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" am: 74f0698ce6 am: 4d206af049
am: 7c88e8a93c

Change-Id: I216863d5b68fed9dab8f0400f05da38ec82f3d25
2019-05-29 10:49:50 -07:00
Chen Xu
7c88e8a93c Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" am: 74f0698ce6
am: 4d206af049

Change-Id: Ib2d02bd3936ae112f62861c301d99582e0b998b0
2019-05-29 10:43:06 -07:00
Varun Anand
7fb81cd05b Merge changes from topic "vpn_data_accounting" into qt-dev am: 071c178990 am: 141246d873
am: b12b74571e

Change-Id: I87e704d91803c20313b61403a4cc2ee0a10cec95
2019-05-29 10:18:57 -07:00
chen xu
381513f5e1 NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions
Bug: 133236378
Test: Manual
Change-Id: I49fbde1fe73b33aadcf8fd23ad224f363b137bf3
Merged-in: I49fbde1fe73b33aadcf8fd23ad224f363b137bf3
2019-05-29 17:16:54 +00:00
Chen Xu
74f0698ce6 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" 2019-05-29 17:15:41 +00:00
Varun Anand
b12b74571e Merge changes from topic "vpn_data_accounting" into qt-dev am: 071c178990
am: 141246d873

Change-Id: If6da5cd1c88b57dd0331f704025109f419c9ea21
2019-05-29 09:55:36 -07:00
Varun Anand
141246d873 Merge changes from topic "vpn_data_accounting" into qt-dev
am: 071c178990

Change-Id: I234eb2b20f47bde94b4aba89867e9d1c7e9ee7d5
2019-05-29 09:44:04 -07:00
Varun Anand
071c178990 Merge changes from topic "vpn_data_accounting" into qt-dev
* changes:
  Add one more test for VPN usage stats.
  Addressing comments for http://ag/7700679.
  NetworkStatsService: Fix getDetailedUidStats to take VPNs into account.
  Take all VPN underlying networks into account when migrating traffic for VPN uid.
2019-05-29 16:34:14 +00:00
Chalard Jean
bd213f3180 Merge "Add a common test library." am: 126a957df5 am: 4343cf32aa am: cb5344664b
am: dc63eea4f2

Change-Id: I95f1961e1467b9167e58ff0577e1e7706a338e41
2019-05-29 05:47:17 -07:00
Chalard Jean
dc63eea4f2 Merge "Add a common test library." am: 126a957df5 am: 4343cf32aa
am: cb5344664b

Change-Id: I9ff0818cac0f65d0e456f27558595a52835e89ab
2019-05-29 05:42:15 -07:00
Chalard Jean
cb5344664b Merge "Add a common test library." am: 126a957df5
am: 4343cf32aa

Change-Id: I6104a1a677cb2e4978f11be32dfc604ee431d009
2019-05-29 05:38:21 -07:00
Chalard Jean
126a957df5 Merge "Add a common test library." 2019-05-29 12:16:08 +00:00
Lorenzo Colitti
20204cdf6a Add one more test for VPN usage stats.
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: Iffd3f95fc2e11d311691a797b010edb38d2ef3c6
2019-05-29 19:57:43 +09:00
Luke Huang
95240f6c93 Merge "Minor changes for DnsUtils and its test" am: 8c4ef95cbb am: dfda15715d am: a771bede7c
am: e3b3cd5400

Change-Id: I4235bc0fb0e330fb376c142fa02107c8b7d701ea
2019-05-29 03:43:18 -07:00
Luke Huang
e3b3cd5400 Merge "Minor changes for DnsUtils and its test" am: 8c4ef95cbb am: dfda15715d
am: a771bede7c

Change-Id: I940cca86b6214ea48d79575c64c9b11680597aa6
2019-05-29 03:38:23 -07:00
Luke Huang
a771bede7c Merge "Minor changes for DnsUtils and its test" am: 8c4ef95cbb
am: dfda15715d

Change-Id: Ic1990922e599884582606d1a4d7da3950200d25c
2019-05-29 03:33:34 -07:00
Varun Anand
78d5ac4f8f Addressing comments for http://ag/7700679.
Note, that its in a separate CL so we could cherry-pick this CL to aosp.
http://ag/7700679 is already in aosp.

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests

Change-Id: I7cfda226b4ed11b67002b83b38fba0f5caf96718
2019-05-29 18:15:34 +09:00
Varun Anand
e7094673d5 NetworkStatsService: Fix getDetailedUidStats to take VPNs into account.
(cherry picked from commit 2af0b66aba)

This API is similar to one provided by NetworkStatsFactory with the
difference that NSS also migrates traffic from VPN UID to other apps.

Since traffic can only be migrated over NetworkStats delta, NSS
therefore maintains NetworkStats snapshot across all UIDs/ifaces/tags.

This snapshot gets updated whenever NSS records a new snapshot
(based on various hooks such as VPN updating its underlying networks,
network getting lost, etc.), or getDetailedUidStats API is invoked by
one of its callers.

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests
Test: manually verified that battery stats are migrating traffic off of
TUN (after patching above CL where we point BatteryStats to use this
API).

Change-Id: I4b8d7c5b6905a4a12c1806dfd35c2c4c63610404
2019-05-29 18:15:24 +09:00
Varun Anand
97482de1fd Take all VPN underlying networks into account when migrating traffic for
VPN uid.

(cherry picked from commit 612520f544)

Bug: 113122541
Bug: 120145746
Test: atest FrameworksNetTests
Test: Manually verified on device that stats from VPN UID are moved
      appropriately based on its declared underlying network set.
Test: vogar --mode app_process --benchmark NetworkStatsBenchmark.java

Change-Id: I7f368c5970b2dcb969fe0daf5ef44edb1f51d09d
2019-05-29 18:15:17 +09:00