Commit Graph

8168 Commits

Author SHA1 Message Date
Automerger Merge Worker
f729c28373 [automerger skipped] Merge changes Iaa78a7ed,I6497b7ef into pi-dev am: 6e79d000ab -s ours
am skip reason: Change-Id Iaa78a7edcf23755c89d7b354edbc28d37d74d891 with SHA-1 9ff61e4948 is in history

Change-Id: I92c1131ef02f7ca5e399b47c62993cf28719b66a
2019-12-12 00:17:28 +00:00
Lorenzo Colitti
b316f633e5 Support strict mode private DNS on VPNs that provide Internet.
Currently, strict mode private DNS does not work on VPNs because
NetworkMonitor does not validate VPNs. When a VPN connects, it
immediately transitions to ValidatedState, skipping private DNS
hostname resolution.

This change makes NetworkMonitor perform private DNS hostname
resolution and evaluation even on VPNs.

In order to ensure that the system always immediately switches to
the VPN as soon as it connects, remove the unvalidated penalty
for VPN networks. This ensures that the VPN score is always 101
and the VPN always outscores other networks as soon as it
connects. Previously, it would only outscore other networks
when no-op validation completed.

Backport of c455822846.

Bug: 122652057
Test: atest FrameworksNetTests
Test: manually ran a VPN with private DNS in strict mode
Test: atest android.net.cts.ConnectivityManagerTest com.android.cts.net.HostsideVpnTests
Change-Id: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
2019-12-11 20:19:40 +09:00
Lorenzo Colitti
7c9b1c757a Add test coverage for strict mode private DNS.
Support faking out the DNS lookups used by NetworkMonitor to
resolve strict mode DNS, and add more test coverage.

These tests were partly adapted from tests we have in Q but
also contain new coverage. This is because in Q the interface
between ConnectivityService and NetworkMonitor changed
substantially, and it is impractical to backport
NetworkMonitorTest.

Bug: 122652057
Test: atest FrameworksNetTests
Change-Id: I6497b7efa539267576d38d3036eef0af0df4e9cb
Merged-In: Iaa78a7edcf23755c89d7b354edbc28d37d74d891
2019-12-11 20:19:29 +09:00
Automerger Merge Worker
01e6f6a35b Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4 am: b24e34c19b am: 8d934b3aac am: edf230a28c
Change-Id: Ibec3f2ac8b0860d4be316da284c5535b8722cbe2
2019-12-11 04:59:42 +00:00
Automerger Merge Worker
edf230a28c Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4 am: b24e34c19b am: 8d934b3aac
Change-Id: Ie95647b87b89337a7556f46ebf1fb577677959bf
2019-12-11 04:38:04 +00:00
Chalard Jean
8d934b3aac Merge changes Ibebdae14,I0c097e77,I6c889b15,I4771f2e9,I2a52f7f4
am: b24e34c19b

Change-Id: I8162ce9e5b1cb813d2b50325cc3a986d6a846a65
2019-12-10 20:13:20 -08:00
Chalard Jean
05cbe97f28 [NS A23.1] Minor cleanup
The argument is always true.

Test: ConnectivityServiceTest
Change-Id: Ibebdae14e63e6baf74db054038ee575ec462f6d5
2019-12-10 14:15:15 +09:00
Chalard Jean
05edd05f53 [NS A23] Move a synchronized block in a central place
As the calls to this apparently need to be synchronized, let's
do it all in the same place instead of in all callers

Test: FrameworksNetTests
Change-Id: I0c097e7756fc155ba0243834b84626e86c68340e
2019-12-10 14:15:14 +09:00
Chalard Jean
cd397a2042 [NS A22] Small refactoring
The point of this is to be able to move parts of processListenRequests
independently.

Test: FrameworksNetTests
Change-Id: I6c889b15696123c1120221977b0f36fa3d91de56
2019-12-10 14:15:14 +09:00
Chalard Jean
1123f5d067 [NS A21] More cleanup
Test: FrameworksNetTests NetworkStackTests
Change-Id: I4771f2e9151ff16a7045d9c3025ac686f244b22d
2019-12-10 14:15:14 +09:00
Chalard Jean
5c4bddb8cd [NS A20] Cleanup
A lot of this code can't be triggered at all.
• newNetwork.created in l.6488 is implied by newNetwork.everConnected
  in l.6357
• !newNetwork.isVPN() in l.6488 is implied by the fact that VPNs are
  always foreground, so oldPermission can't != newPermission in l.6488
• updateUids in l.6502 is useless because uids can't change during a
  rematch (because there is no code doing that). Metered state and
  roaming state similarly can't change during a rematch, so
  meteredChanged and roamingChanged are always false
• updateAllVpnCapabilities in l.6537 is useless because VPN do not
  inherit the foreground state of their underlying networks, which
  would be the only reason to call that in l.6537
• Object.equals() in l.6480 is necessary false because at this line
  it is known that the foreground state has changed, which must have
  caused the NET_CAPABILITY_FOREGROUND to be different, so the objects
  can't be equal

Test: FrameworksNetTests NetworkStackTest
Change-Id: I2a52f7f4a085f3eea22a1dd170af8f04671250ff
2019-12-10 14:14:57 +09:00
Jeffrey Huang
ff20677c23 Merge "Rename writeToProto to be dumpDebug" 2019-12-06 18:53:15 +00:00
lucaslin
57f8ed7867 Merge "Remove incorrect annotation - @TransportType" am: ac81b72e22 am: 26468789ea
am: 70c11a69ac

Change-Id: Ib551ea9fbdfd0a927c4570560ba74148e43453c1
2019-12-06 01:02:15 -08:00
lucaslin
70c11a69ac Merge "Remove incorrect annotation - @TransportType" am: ac81b72e22
am: 26468789ea

Change-Id: Ia82a146de1afadcc415ba69fd5cf01480332b37f
2019-12-05 21:01:12 -08:00
lucaslin
26468789ea Merge "Remove incorrect annotation - @TransportType"
am: ac81b72e22

Change-Id: I99b74e5e67f5ff6f8d35f627e2c40ef4ca001c0c
2019-12-05 20:57:08 -08:00
Treehugger Robot
ac81b72e22 Merge "Remove incorrect annotation - @TransportType" 2019-12-06 04:50:27 +00:00
lucaslin
387ce1a837 Remove incorrect annotation - @TransportType
This annotation is mis-adding by aosp/929879, and now it also
makes compilation failure for Telephony Mainline.

Bug: 145755373
Test: atest FrameworksNetTests
Change-Id: Ic22ce6bf17c4300b8cd52217976bfb215a123f68
2019-12-06 11:17:25 +08:00
Jeffrey Huang
3d97148418 Rename writeToProto to be dumpDebug
We want to eventually migrate some of these APIs to be @SystemApi for mainline modules.
The #dumpDebug name is more appropriate than #writeToProto.

Bug: 142279786
Test: Manual
Change-Id: I60793e91cedf6b720d4ecef6a8484f4fed4ff30f
2019-12-05 11:28:11 -08:00
markchien
be1810eddd Merge "Expose netId to SystemApi" am: ed2644bf65 am: 4127bbc6bf
am: 25797f3843

Change-Id: I4dce3a699666c8f75e028b7dc2e196ca0b44b41c
2019-12-05 00:43:27 -08:00
markchien
25797f3843 Merge "Expose netId to SystemApi" am: ed2644bf65
am: 4127bbc6bf

Change-Id: I23f6428954d08761d9671b419887d58dd29171fd
2019-12-04 18:39:46 -08:00
markchien
4127bbc6bf Merge "Expose netId to SystemApi"
am: ed2644bf65

Change-Id: I930b421d373ac67ec5987b9440a45e6dbc536074
2019-12-04 18:35:41 -08:00
Treehugger Robot
ed2644bf65 Merge "Expose netId to SystemApi" 2019-12-05 02:29:41 +00:00
Automerger Merge Worker
abebb56039 [automerger skipped] Merge "Replace the permission of internal connectivity checks" am: 032c3c3e30 am: 673e20a9f2 -s ours
am skip reason: Change-Id I8f2dd1cd0609056494eaf612d39820e273ae093f with SHA-1 e031948c1a is in history

Change-Id: Ib7fe99ba9f914d33da3145b926568bcbe418e6b2
2019-12-04 20:01:55 +00:00
Automerger Merge Worker
515f11f5d8 Merge changes Ie756b9aa,I38110f3a am: e38a525a05 am: 08c816b3f0
Change-Id: I884650a0a0fbf1a96f81ca927886eb2a563f4e28
2019-12-04 19:56:21 +00:00
Automerger Merge Worker
5a56b9ddf1 Merge "Merge Android10 QPR1 into AOSP master" am: 20a8c06313 am: 4fd3dcc002
Change-Id: Ia31d8ba0396b6a5bf63863b4318b7543283851b2
2019-12-04 16:58:08 +00:00
Paul Hu
673e20a9f2 Merge "Replace the permission of internal connectivity checks" am: 032c3c3e30
am: e43ab9369b

Change-Id: I461936789b24940cc81146e9d0fc6c4c455206ed
2019-12-04 08:51:28 -08:00
Chalard Jean
08c816b3f0 Merge changes Ie756b9aa,I38110f3a am: e38a525a05
am: 0c0bf65507

Change-Id: I8695507cb084a198308b5765bc8fb873ca3f6a30
2019-12-04 08:50:54 -08:00
Xin Li
4fd3dcc002 Merge "Merge Android10 QPR1 into AOSP master" am: 20a8c06313
am: 40e8826773

Change-Id: I3bf58b1afbff9e0a40106771a9f389b1e2c1b940
2019-12-04 08:09:19 -08:00
markchien
d2751e09d2 Expose netId to SystemApi
Tethering will be build as unblundled APP. It can't use @hide
API anymore. Expose netId for tethering because it need to set
proxy dns server with netId.

Bug: 144758139
Test: build
Change-Id: Ifefa791940874617bb479f5c23488d14be87f45e
2019-12-04 14:33:51 +08:00
Paul Hu
e43ab9369b Merge "Replace the permission of internal connectivity checks"
am: 032c3c3e30

Change-Id: I5bb6a6074a2ac08f04147d415fb1d2bfbd411850
2019-12-03 22:04:50 -08:00
Paul Hu
032c3c3e30 Merge "Replace the permission of internal connectivity checks" 2019-12-04 05:59:59 +00:00
Paul Hu
f9ed2de1dd Merge "Replace the permission of internal connectivity checks" 2019-12-04 05:52:01 +00:00
paulhu
e031948c1a Replace the permission of internal connectivity checks
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permission
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
all CONNECTIVITY_INTERNAL to other proper permissions.

Bug: 32963470
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I8f2dd1cd0609056494eaf612d39820e273ae093f
2019-12-04 11:45:51 +08:00
paulhu
8e96a75543 Replace the permission of internal connectivity checks
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permission
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
all CONNECTIVITY_INTERNAL to other proper permissions.

Bug: 32963470
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I8f2dd1cd0609056494eaf612d39820e273ae093f
Merged-In: I8f2dd1cd0609056494eaf612d39820e273ae093f
2019-12-04 11:44:45 +08:00
Chalard Jean
0c0bf65507 Merge changes Ie756b9aa,I38110f3a
am: e38a525a05

Change-Id: I69e6c9234f0a983a56ee19d4d4dfe97618dc8f56
2019-12-03 18:18:53 -08:00
Treehugger Robot
e38a525a05 Merge changes Ie756b9aa,I38110f3a
* changes:
  [NS A19] Inline updateCapabilities in rematch.
  [NS A18] Reverse listens and request-availables
2019-12-04 02:07:45 +00:00
Xin Li
40e8826773 Merge "Merge Android10 QPR1 into AOSP master"
am: 20a8c06313

Change-Id: I3b2912dffdd5be501077c9983bb922ee7a3767d1
2019-12-03 16:09:13 -08:00
Treehugger Robot
20a8c06313 Merge "Merge Android10 QPR1 into AOSP master" 2019-12-03 23:15:02 +00:00
Automerger Merge Worker
9029839020 Merge "Disable a flaky test" am: 932dda858a am: c8ce461f68
Change-Id: Ia3596b558fb09600e7d9a16f0dce03d4402ee653
2019-12-03 16:51:32 +00:00
Chalard Jean
c8ce461f68 Merge "Disable a flaky test" am: 932dda858a
am: 54546f8429

Change-Id: Ie1fccb536e6df45491139ead179e8f5c2127d98f
2019-12-03 08:38:00 -08:00
Chalard Jean
54546f8429 Merge "Disable a flaky test"
am: 932dda858a

Change-Id: I8a6fc40976c6ab234cabd4af37dc4a530e2b47a1
2019-12-03 08:30:03 -08:00
Chalard Jean
54ef9299c7 Disable a flaky test
Bug: 145513323
Test: FrameworkNetTests
Change-Id: I66e02fdaab2969b77db4a0f0e6fb8b1a981d9350
2019-12-03 16:13:22 +09:00
Xin Li
4b20d94557 Merge Android10 QPR1 into AOSP master
Bug: 145570283
Change-Id: I557701733b49b0f231c89165239ba07c0fa288d2
2019-12-02 21:25:07 -08:00
Aaron Huang
8d6ae5d59f Add LinkProperties methods to system APIs
The exposed methods are used by telephony, wifi
and tethering. For mainline support, making the
methods @SystemApi.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: atest FrameworksNetTests
      atest NetworkStackTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
      atest android.net.cts
      atest android.net.wifi.cts
      atest android.telephony.cts

Change-Id: Ib16a838cf9f748e1c5b045d6c2f17678f16af28c
2019-12-02 19:29:18 +08:00
Chalard Jean
6bef9a37a1 Merge changes I720a1feb,I9539b8cc,Ib79b777b am: adb58138bd am: f3402da572
am: e78a4b9168

Change-Id: I6bfd8dc565cb4b835f65c3e144848bd6099272c7
2019-12-02 01:59:20 -08:00
Chalard Jean
e78a4b9168 Merge changes I720a1feb,I9539b8cc,Ib79b777b am: adb58138bd
am: f3402da572

Change-Id: I66a58f6f54a4d423ad603a2b642e6510c29bc07a
2019-12-02 01:55:20 -08:00
Chalard Jean
f3402da572 Merge changes I720a1feb,I9539b8cc,Ib79b777b
am: adb58138bd

Change-Id: Ieaa1371f6e52074b76e3353ea9a2653c783ff04e
2019-12-02 01:51:07 -08:00
Chalard Jean
959c7cd889 [NS A19] Inline updateCapabilities in rematch.
This is ugly, but it's a necessary step to improve the code.
Followups will clean this up. Importantly this kind of inlining
will let us break the very confusing apparent loop between
updateCapabilities and rematch.

Test: FrameworksNetTests
Change-Id: Ie756b9aa8066984264717f0b1e1f31606432f1a4
2019-12-02 18:44:11 +09:00
Chalard Jean
9127f03a5c [NS A18] Reverse listens and request-availables
This is a long standing bug that happens to now be trivial
to fix, and also be beneficial for refactoring

Test: FrameworksNetTests NetworkStackTests
Change-Id: I38110f3a4a75936ea755788e7f9fee67863e14be
2019-12-02 18:44:10 +09:00
Chalard Jean
adb58138bd Merge changes I720a1feb,I9539b8cc,Ib79b777b
* changes:
  [NS A17] Update linger state after rematching.
  [NS A16] Cleanup
  [NS A15] Move legacy default broadcasts out of the loop
2019-12-02 09:40:44 +00:00