Commit Graph

7030 Commits

Author SHA1 Message Date
Junyu Lai
bafc7c9b8f Merge "Correct value of supported keepalive count for cellular" am: 7423873ac8
am: 056eeae27c

Change-Id: If833b813ba00eeff913160598f1ea9c74e6e35d8
2019-06-19 07:28:53 -07:00
Junyu Lai
7423873ac8 Merge "Correct value of supported keepalive count for cellular" 2019-06-19 14:08:31 +00:00
Paul Hu
232ad69eaa Merge "Add SocketUtils CTS tests" am: 37377069ba
am: f97246a87c

Change-Id: I11e638a2fab004979298708a5c75bb7c2f208f67
2019-06-18 04:12:27 -07:00
Paul Hu
37377069ba Merge "Add SocketUtils CTS tests" 2019-06-18 10:46:30 +00:00
Chalard Jean
dd6df6a38f [automerger skipped] Merge "Remove the <= P restriction for WIFI_P2P" into qt-dev
am: 2ae76cdbe8 -s ours
am skip reason: change_id I56c86b0c1912064d5a642991df32d2cefb6a8d5b with SHA1 a070aaa88f is in history

Change-Id: Ib3b27436b44e678f026ce5026abf23db2f50a4cf
2019-06-17 23:35:11 -07:00
Chalard Jean
c34b699c2e Remove the <= P restriction for WIFI_P2P
This is still sent in an intent.

Bug: 131764329
Fixes: 131764329
Merged-In: I56c86b0c1912064d5a642991df32d2cefb6a8d5b
Change-Id: I64b9d632be97dc51e6085162371bb8c19f410258
(cherry picked from commit e546cb0bd16b7359feeb3c46ba52e64cf91ae4d3)
2019-06-18 06:15:58 +00:00
Varun Anand
950e0419c0 Merge changes Ieb8645ac,I6466ec14,I87deb82b,I995b108e,Ib6521459 am: 2ce04660f6
am: 48f59a0fdf

Change-Id: I960e94b03b29282ae2b03f78a19ed2692bd88e05
2019-06-17 10:33:53 -07:00
Varun Anand
2ce04660f6 Merge changes Ieb8645ac,I6466ec14,I87deb82b,I995b108e,Ib6521459
* changes:
  Remove VPN info arrays from NetworkStats(Observer|Recorder)
  NetworkStatsFactory: Take VPNs into account for network/battery stats
  Remove duplicate line in clat_simple test file
  Remove unused lastStats parameter
  Revert "Revert "Take all VPN underlying networks into account when migrating traffic for""
2019-06-17 15:56:24 +00:00
Chalard Jean
649a5747ef Merge "Remove the <= P restriction for WIFI_P2P" am: 43a52d0aaa
am: bb754c9c8d

Change-Id: I14f5865249740587d550ac31b59883f4a87fd4a1
2019-06-17 08:20:18 -07:00
Treehugger Robot
43a52d0aaa Merge "Remove the <= P restriction for WIFI_P2P" 2019-06-17 14:58:21 +00:00
Chalard Jean
990438b35b [automerger skipped] Merge changes I80bebcd0,I35f3718f into qt-dev
am: 08793a3b64 -s ours
am skip reason: change_id Iad0e9a28670e96a3c953518a0d0ccd77e2f2fa80 with SHA1 6988872c91 is in history

Change-Id: I9094b83959e1f75f90edac095060240c129b73b0
2019-06-17 07:21:50 -07:00
Chalard Jean
5411bda0ca Simplification of code to prevent a Log.wtf in expected cases.
This mostly serves to unindent code to make it locally more
readable. It is a functional no-op.

Bug: 135043192
Test: atest FrameworksNetTests
Merged-In: Iad0e9a28670e96a3c953518a0d0ccd77e2f2fa80
Change-Id: I80bebcd04c277f6e4b0665fe1253b2309e3bc535
(cherry picked from commit e1f5759319a4559b3cf89029449878dc56f92bb7)
2019-06-17 13:16:46 +00:00
Chalard Jean
164ce6f0da Merge "Simplification of code to prevent a Log.wtf in expected cases." am: 3cc6f6627f
am: fbc68b975a

Change-Id: I5f5fa22468c8db09e4eeb3d446220b4ebc396d98
2019-06-17 04:24:08 -07:00
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
Chalard Jean
3cc6f6627f Merge "Simplification of code to prevent a Log.wtf in expected cases." 2019-06-17 10:37:50 +00:00
Chalard Jean
6988872c91 Simplification of code to prevent a Log.wtf in expected cases.
This mostly serves to unindent code to make it locally more
readable. It is a functional no-op.

Bug: 135043192
Test: atest FrameworksNetTests
Change-Id: Iad0e9a28670e96a3c953518a0d0ccd77e2f2fa80
2019-06-17 18:01:35 +09:00
Xiao Ma
6033e849b2 Merge "Restore the Private DNS settings to default mode upon network resets." into qt-dev
am: 49fd0568b5

Change-Id: I42959ec5d1194851294e007e6e3d872678a85b6d
2019-06-16 21:15:04 -07:00
Chiachang Wang
799bf5a8cc 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
Merged-In: I91b92249dc7905aadbc59df50c3bc6da30a8590e
Merged-In: Ia1c2a765b0fb0cc8d440c02533bdc15774a5a3ef
(cherry picked from commit ed0a54bd07ea1c9072459bafeaf796eaa4dad4c5)
2019-06-17 02:09:27 +00:00
TreeHugger Robot
49fd0568b5 Merge "Restore the Private DNS settings to default mode upon network resets." into qt-dev 2019-06-17 01:08:00 +00:00
Benedict Wong
fde4dfd156 Remove VPN info arrays from NetworkStats(Observer|Recorder)
This change removes the now-unused VPN arrays in the network stats
observer and recorder classes. These are always null values in every
call site.

Bug: 113122541
Bug: 120145746
Bug: 129264869
Bug: 134244752
Test: FrameworksNetTest passing
Test: Manual tests show data usage fixes maintained.
Change-Id: Ieb8645acc400fdaeb0df7092c5369b96f9f35af9
2019-06-14 11:41:31 -07:00
Benedict Wong
9308cd307a NetworkStatsFactory: Take VPNs into account for network/battery stats
This change fixes detailed UID stats to ensure network and battery stats
both take VPNs into account. NetworkStatsFactory is being made aware of
VPNs enabled, and the full set of underlying networks present.

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

This snapshot gets updated whenever NSF records a new snapshot
(based on various hooks such as VPN updating its underlying networks,
network getting lost, etc.), or NetworkStatsService's
getDetailedUidStats() method being called.

This change widens the scope of the existing mPersistentSnapshot lock,
renaming it to mPersistentDataLock, and ensures that TUN migrations are
not done in parallel. Additionally, mVpnInfos is updated via
pointer-swapping, to reduce the scope of the mPersistentDataLock.

The safety of this change is predicated on:
1. NetworkStatsFactory lock not held, so services cannot deadlock through
the cyclical lock.

2. The broadening of the scope of the lock in NetworkStatsFactory has no
threading implications, as it is always the last (leaf node) lock held,
and therefore is impossible to have lock inversion.

Additionally, to ensure VPNs work with 464xlat, the VPN info passed to
the NetworkStatsFactory includes all underlying interfaces, instead of
only passing the first one.

This (partially) re-applies changes from:
aosp/972848: Add one more test for VPN usage stats.
aosp/972847: Addressing comments for http://ag/7700679.
aosp/885338: NetworkStatsService: Fix getDetailedUidStats to take VPNs
             into account.
Co-developed with: Varun Anand <vaanand@google.com>

Bug: 113122541
Bug: 120145746
Bug: 129264869
Bug: 134244752
Test: FrameworksNetTest passing
Test: Manual tests show data usage fixes maintained.
Change-Id: I6466ec1411fc5ed6954125d27d353b6cd1be719e
2019-06-14 11:41:31 -07:00
Benedict Wong
6632202cb7 Remove duplicate line in clat_simple test file
This change removes a redundant line in the xt_qtaguid_with_clat test
file.

Bug: 134244752
Test: FrameworksNetTest passing
Change-Id: I87deb82ba960102b617ab27362e8c5899fa478f8
2019-06-14 11:16:03 -07:00
paulhu
c674eb967e Add SocketUtils CTS tests
Test APIs below:
makeNetlinkSocketAddress(int, int)
makePacketSocketAddress(short, int)
makePacketSocketAddress(int, byte[])
closeSocket(java.io.FileDescriptor)

Bug:129200596
Test: atest FrameworksNetTests
      atest CtsNetTestCases --instant

Change-Id: I395360161123d8b712b6c2cf3251b8144641350e
2019-06-14 15:33:52 +08:00
Heemin Seog
38b73db735 Merge "Change factoryReset to succeed for Settings" am: c687700cde
am: 9d59a75463

Change-Id: I9b7ce285fc205255dd9e2e0fa71afd0f8392d243
2019-06-14 00:25:17 -07:00
Treehugger Robot
c687700cde Merge "Change factoryReset to succeed for Settings" 2019-06-14 07:02:17 +00:00
Lorenzo Colitti
91a70b46c8 Merge "Change factoryReset to succeed for Settings" into qt-dev
am: 015f25c3fa

Change-Id: Iea895d4bbbae2fd6ddaf0c7627c8066c0a7e6033
2019-06-13 21:52:34 -07:00
Lorenzo Colitti
015f25c3fa Merge "Change factoryReset to succeed for Settings" into qt-dev 2019-06-14 04:13:27 +00:00
Benedict Wong
34857f82f5 Revert "Revert "Take all VPN underlying networks into account when migrating traffic for""
This reverts commit 048c1c6c32.

Reason for revert: Fix available for deadlocks.

Bug: 134244752
Change-Id: Ib65214598837289bd39dbf040b56ab7835f893ba
2019-06-13 15:36:27 -07: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
Heemin Seog
d9cdbc1e45 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.

Bug: 135029349
Test: build, manual
Change-Id: Iea246a4c1939a4e7e35434137051835ece81d92f
2019-06-13 09:19:48 -07:00
Chiachang Wang
0898430932 Merge "Suppress the wtf log for notifications that are expected" am: fbb97ab240
am: 4e3761e1d9

Change-Id: Ia1c2a765b0fb0cc8d440c02533bdc15774a5a3ef
2019-06-13 02:29:06 -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
Luke Huang
459cc5e56f Merge "Fix race condition caused by fd reused for DnsResolver" into qt-dev
am: 7187dbc4e0

Change-Id: Ib33d8a7955039eb6ec40c949670a52fa2f76660a
2019-06-12 01:22:07 -07:00
Xiao Ma
f94d57a6e5 Restore the Private DNS settings to default mode upon network resets.
Bug: 134918038
Test: atest FrameworksNetTests NetworkStackTests
Test: manual test
      configure private dns settings (e.g. dns.google) -> connect Wi-Fi
      -> click "Reset Wi-Fi, mobile & Bluetooth" -> verify private dns
      settings is automatic -> connect Wi-Fi -> verify Internet
      connection.

Change-Id: I13562af622d7b584d6219f74534219b7868275f9
2019-06-12 16:31:14 +09:00
Mark Chien
c39e80e64c Merge "Fix NullPointerException in ConnectivityService" am: fe8af96eba
am: d0e6636019

Change-Id: If0c65bd11f5b76e35f6033fa79a8938f7e47a8e7
2019-06-11 23:43:37 -07:00
Mark Chien
fe8af96eba Merge "Fix NullPointerException in ConnectivityService" 2019-06-12 06:24:41 +00:00
Varun Anand
e16dc7932b [automerger skipped] Merge changes from topic "vpn_data_accnt_revert" am: cec619e577
am: 39f9c1c212 -s ours
am skip reason: change_id Ibdaad3a4cbf0d8ef1ed53cfab1e454b9b878bae9 with SHA1 4c94d3051d is in history

Change-Id: I47d22d76e3525efc7771e6b514ebadc9b2c75e22
2019-06-11 19:03:04 -07: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
c23ae79df5 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

Merged-In: I443bb11b15845b079ee4370a7797e692e62fa3c8
(cherry picked from commit 07de4cf82ac09f8b9f37afa9eb1b7a44b43b6fe6)

Change-Id: I7041e67d8c906cbf88050e7d94245f8e15dcdbb4
2019-06-11 17:33:39 +00:00
Luke Huang
bab0336604 Merge "Fix race condition caused by fd reused for DnsResolver" am: 7c98ae7d01
am: f8a2c15ca1

Change-Id: I93e0d4a8664a16f2814763346ff00e6c874efd02
2019-06-11 08:52:18 -07:00
Luke Huang
7c98ae7d01 Merge "Fix race condition caused by fd reused for DnsResolver" 2019-06-11 15:32:17 +00:00
Aaron Huang
ede0d5075b Correct value of supported keepalive count for cellular
Cellular only supports 1 keepalive connection so correct the default
supported value to 1.

Bug: 134037217
Test: - atest FrameworksNetTests
      - atest android.net.cts.ConnectivityManagerTest \
        #testSocketKeepaliveLimitTelephony

Change-Id: Ia3761f2e78d54866bb2e156d58004396bbc8adc3
2019-06-11 22:04:34 +08: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
Benedict Wong
e3f39c01ba Revert "Take all VPN underlying networks into account when migrating traffic for"
am: 4c94d3051d

Change-Id: Ie9e830962e702c5e66faa7239e6c5037ed3d791d
2019-06-07 02:33:33 -07:00
Benedict Wong
74804a8abd Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
am: ebf6303f1d

Change-Id: I9bf180aca56a8b5e2c5262beabac3ceaa9b00315
2019-06-07 02:33:30 -07:00