Commit Graph

4457 Commits

Author SHA1 Message Date
Neil Fuller
2350886e09 Merge "Switch to a single PacketSocketAddress constructor" am: 2d24f7a39e am: a357696c2f am: 9ec43cc7fe
am: dcf7d6e377

Change-Id: I999d61e1086f9a1cfcf9cf38522eb4c2779b607c
2019-06-20 14:42:30 -07:00
Chalard Jean
aa0d4adc2b Merge "Factorize custom asserts." am: 6c176efa3d am: 99fbb40990 am: f1eab99357
am: bef7ff11e2

Change-Id: I1eecc5dd9f8c77287b8cca76f5d647a23a9a2f7a
2019-06-20 14:29:43 -07:00
Neil Fuller
9ec43cc7fe Merge "Switch to a single PacketSocketAddress constructor" am: 2d24f7a39e
am: a357696c2f

Change-Id: I7db11188d9dd42e25b0aebd79acc92a9ba2f56a0
2019-06-20 14:06:50 -07:00
Chalard Jean
f1eab99357 Merge "Factorize custom asserts." am: 6c176efa3d
am: 99fbb40990

Change-Id: I65ea7497abb8b77ebd10ba622075ef3b6c49b2a8
2019-06-20 14:01:31 -07:00
Neil Fuller
2d24f7a39e Merge "Switch to a single PacketSocketAddress constructor" 2019-06-20 14:09:15 +00:00
Neil Fuller
6ae89f2f9c Switch to a single PacketSocketAddress constructor
Switch to a single PacketSocketAddress constructor to
avoid multiple unnecessary overloads in the
Core Platform API.

Bug: 133196453
Bug: 124232146
Test: build only
Change-Id: I30533ac3aa99c2cd09e8c624fedf6000b0f52c11
2019-06-20 09:24:43 +01:00
Chalard Jean
9c0ff1b005 Factorize custom asserts.
Also a few utilities that were in the way, and some opportunistic
cleanups.

Test: FrameworksNetTest NetworkStackTest
Change-Id: I385070e2044fd967cb18f1ffea9a86a4627b742e
2019-06-20 16:24:25 +09:00
Junyu Lai
f4d70dc9e3 Merge "Move the test of minimum supported keepalive slots to CTS" am: 579a99e558 am: 6ff00fee75 am: aed835f086
am: d2098f84d0

Change-Id: I13f47ed986756933172886d7e0c9b5d653fc34e7
2019-06-19 07:44:59 -07:00
Junyu Lai
c399dc1fb0 Merge "Correct value of supported keepalive count for cellular" am: 68a4599a37 am: 056eeae27c am: 680abbb591
am: 734d90759a

Change-Id: I621066b8c4cd9b244b4d70f84d428b5b784e0387
2019-06-19 07:44:39 -07:00
Junyu Lai
aed835f086 Merge "Move the test of minimum supported keepalive slots to CTS" am: 579a99e558
am: 6ff00fee75

Change-Id: Ib9b06d3458782a648a2f5b8fd5a9ca1d34bd11f9
2019-06-19 07:29:11 -07:00
Junyu Lai
680abbb591 Merge "Correct value of supported keepalive count for cellular" am: 68a4599a37
am: 056eeae27c

Change-Id: If833b813ba00eeff913160598f1ea9c74e6e35d8
2019-06-19 07:28:53 -07:00
Junyu Lai
579a99e558 Merge "Move the test of minimum supported keepalive slots to CTS" 2019-06-19 14:08:31 +00:00
Junyu Lai
68a4599a37 Merge "Correct value of supported keepalive count for cellular" 2019-06-19 14:08:31 +00:00
junyulai
edde28b709 Move the test of minimum supported keepalive slots to CTS
This change also enables log when keepalive is started.

Bug: 134352656
Test: 1. atest android.net.cts.ConnectivityManagerTest#testSocketKeepaliveLimitTelephony
      2. atest FrameworksNetTests
Change-Id: I408750fa0bceb0c1c26afb5fead4e44fb824fbc1
2019-06-19 16:25:19 +08:00
TreeHugger Robot
0c0d9bd53d Merge "Flatten Uri.AbstractPart.Representation." 2019-06-17 18:13:39 +00:00
Varun Anand
2135806a00 Merge changes Ieb8645ac,I6466ec14,I87deb82b,I995b108e,Ib6521459 am: f4c10e8bc2 am: 48f59a0fdf am: 2471441b2d
am: 8775b0a135

Change-Id: I8415a7c91158cce99e91e6054ed4f40e44563b89
2019-06-17 10:59:29 -07:00
Varun Anand
2471441b2d Merge changes Ieb8645ac,I6466ec14,I87deb82b,I995b108e,Ib6521459 am: f4c10e8bc2
am: 48f59a0fdf

Change-Id: I960e94b03b29282ae2b03f78a19ed2692bd88e05
2019-06-17 10:33:53 -07:00
Varun Anand
f4c10e8bc2 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
88a98dec60 Merge "Remove the <= P restriction for WIFI_P2P" am: 4e8973e9a8 am: bb754c9c8d am: b199795653
am: cd8755aa9e

Change-Id: I78bc539eb0504473f67914414b8bf062dee093b4
2019-06-17 08:43:32 -07:00
Chalard Jean
b199795653 Merge "Remove the <= P restriction for WIFI_P2P" am: 4e8973e9a8
am: bb754c9c8d

Change-Id: I14f5865249740587d550ac31b59883f4a87fd4a1
2019-06-17 08:20:18 -07:00
Tobias Thierer
64fe70577a Flatten Uri.AbstractPart.Representation.
This CL drops an unneeded internal class and clarifies
what the constant values are used for.

Test: Treehugger
Change-Id: Ie5e364ec535fba0ae4a57fc9901be77ce10479c4
2019-06-17 14:29:29 +01:00
Chalard Jean
2253ff94e3 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
Benedict Wong
9fbbdebc61 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
a84d9fa572 Revert "Revert "Take all VPN underlying networks into account when migrating traffic for""
This reverts commit d8220c2050.

Reason for revert: Fix available for deadlocks.

Bug: 134244752
Change-Id: Ib65214598837289bd39dbf040b56ab7835f893ba
2019-06-13 15:36:27 -07:00
Varun Anand
8af90ce15b 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
07de4cf82a Merge "Fix race condition caused by fd reused for DnsResolver" am: 3f2aa4190d am: f8a2c15ca1 am: cc949037c3
am: 9699fb25c9

Change-Id: I443bb11b15845b079ee4370a7797e692e62fa3c8
2019-06-11 09:08:00 -07:00
Luke Huang
cc949037c3 Merge "Fix race condition caused by fd reused for DnsResolver" am: 3f2aa4190d
am: f8a2c15ca1

Change-Id: I93e0d4a8664a16f2814763346ff00e6c874efd02
2019-06-11 08:52:18 -07:00
Aaron Huang
c0de2838e7 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
5b31126c9d 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
d8220c2050 Revert "Take all VPN underlying networks into account when migrating traffic for"
This reverts commit 95aa6d446f.

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
6a04d49ff2 Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
This reverts commit 29d2ef2fe1.

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
4f16107e3c Revert "Addressing comments for http://ag/7700679."
This reverts commit e4bfdccb57.

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
Benedict Wong
f31b3fdcaa Revert "Take all VPN underlying networks into account when migrating traffic for" am: ac06c1022d am: f0904ebfc0
am: 27e91edd6b

Change-Id: I5306f76761ce4ae3c8a0ec89b6bdea3e004a1d73
2019-06-07 02:48:37 -07:00
Benedict Wong
eacc286809 Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account." am: 055992b112 am: 22f6a82c96
am: 4c78fb4c61

Change-Id: I6e9f5b04bbb036c13eedee6e8d079a48f14f5685
2019-06-07 02:48:33 -07:00
Benedict Wong
b8da24bcf6 Revert "Addressing comments for http://ag/7700679." am: 1fbf261c01 am: 543883e3c4
am: 0adc53072c

Change-Id: If2c644ab4b69f385a6e939ca4760530c196f098d
2019-06-07 02:48:29 -07:00
Benedict Wong
f0904ebfc0 Revert "Take all VPN underlying networks into account when migrating traffic for"
am: ac06c1022d

Change-Id: Ie9e830962e702c5e66faa7239e6c5037ed3d791d
2019-06-07 02:33:33 -07:00
Benedict Wong
22f6a82c96 Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
am: 055992b112

Change-Id: I9bf180aca56a8b5e2c5262beabac3ceaa9b00315
2019-06-07 02:33:30 -07:00
Benedict Wong
543883e3c4 Revert "Addressing comments for http://ag/7700679."
am: 1fbf261c01

Change-Id: I56e7736ced431a5dcd78a6a258abfad09745d25e
2019-06-07 02:33:26 -07:00
Benedict Wong
ac06c1022d Revert "Take all VPN underlying networks into account when migrating traffic for"
This reverts commit 917327b193.

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

Bug: 134244752
Change-Id: Ibdaad3a4cbf0d8ef1ed53cfab1e454b9b878bae9
2019-06-07 09:18:01 +00:00
Benedict Wong
055992b112 Revert "NetworkStatsService: Fix getDetailedUidStats to take VPNs into account."
This reverts commit ed11b84131.

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

Bug: 134244752
Change-Id: I0c00e8f0e30cee987b71b561079a97bf09d4dae4
2019-06-07 09:17:47 +00:00
Benedict Wong
1fbf261c01 Revert "Addressing comments for http://ag/7700679."
This reverts commit a229333986.

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

Bug: 134244752
Change-Id: I5fbb3443a39a21fc9d96442726cd10d20e8d61cd
2019-06-07 09:17:31 +00:00
Lorenzo Colitti
79e58ad901 Merge "Allow passing in acceptUnvalidated without explicitlySelected" 2019-06-05 05:00:14 +00:00
Lorenzo Colitti
fd799860c7 Merge "Allow passing in acceptUnvalidated without explicitlySelected" into qt-dev am: e2fb127e41 am: e0348e5a6f
am: 3a19df0784

Change-Id: I516f47609c552e8213c218ba9fc0f665fed4b63a
2019-06-04 20:29:05 -07:00
Lorenzo Colitti
091de3f0a6 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 0e33bd1167)
2019-06-05 11:12:18 +09:00
Lorenzo Colitti
e0348e5a6f Merge "Allow passing in acceptUnvalidated without explicitlySelected" into qt-dev
am: e2fb127e41

Change-Id: Ifd9dbc9c83e426e66417247cbf1fa594193e000f
2019-06-04 18:29:51 -07:00
TreeHugger Robot
e2fb127e41 Merge "Allow passing in acceptUnvalidated without explicitlySelected" into qt-dev 2019-06-04 18:00:31 +00:00
junyulai
f6316e7314 Merge "Fix cannot create Nat-T keepalive on mobile data" into qt-dev am: eabafd5ceb am: 0b0b339e8b
am: a2de419d58

Change-Id: If22a74559b3dd5ad0cd2dc7dd12becf2e0b1e59e
2019-06-04 09:08:35 -07:00
junyulai
0b0b339e8b Merge "Fix cannot create Nat-T keepalive on mobile data" into qt-dev
am: eabafd5ceb

Change-Id: I580b4dd2e493430e8420ca0907f9cf7d1d5a8773
2019-06-04 08:48:21 -07:00
Lorenzo Colitti
0e33bd1167 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
2019-06-04 14:35:22 +00:00
junyulai
931ec8efa0 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

Merged-In: If630d5b339aa722717258c721daa8ead8c431e2d
Change-Id: Ic0f168be6f5a6263a5e0565b6381dcb5c645660f
(cherry picked from commit 9ede677bb2)
2019-06-04 20:44:29 +08:00