Commit Graph

11962 Commits

Author SHA1 Message Date
James Mattis
1c03df3a3e Merge changes from topics "pans", "pans-permission"
* changes:
  Marking setOemNetworkPreference as @SystemApi
  Adding permission for OEM managed preferences
  Implementation of setOemNetworkPreference
2021-02-13 20:54:57 +00:00
Yan Yan
58d98d8708 Merge changes Ifc8ad902,I6d1b8d0e am: 4273004991
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1453730

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I12bd81925142b20a04448952de67cb72d77b4ccd
2021-02-12 21:41:59 +00:00
Yan Yan
4273004991 Merge changes Ifc8ad902,I6d1b8d0e
* changes:
  [API] Expose IpSecTunnelInterface#setUnderlyingNetwork
  Update underlying network of IpSecTunnelInterface
2021-02-12 21:23:29 +00:00
Treehugger Robot
e3ca168e88 Merge "Stop using Slog in QosCallbackTracker." am: af1216208b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1585567

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6df42ce17addb1f433eba440ba4593b2e4ca57e5
2021-02-12 05:18:13 +00:00
James Mattis
da32cfeebf Marking setOemNetworkPreference as @SystemApi
Marking setOemNetworkPreference in ConnectivityManager as @SystemApi.

Bug: 176496438
Bug: 176494815
Test: atest FrameworksNetTests
atest FrameworksNetIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I4681c88dc3a83f71c387b29610c33594e57cb43f
2021-02-11 20:38:21 -08:00
James Mattis
8378aec5fb Adding permission for OEM managed preferences
Adding CONTROL_OEM_PAID_NETWORK_PREFERENCE as a signature level
permission to allow an application to control OEM managed network
preferences.

Bug: 176496438
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk
Change-Id: Iee13e89f3931c7079c2d88cb57b249b1b1cf93ad

Change-Id: Id29cafe1eaf5dff8a0605cb2579204d9c77b7e70
2021-02-11 20:38:21 -08:00
James Mattis
45d81845a4 Implementation of setOemNetworkPreference
Main implementation of ConnectivityService.setOemNetworkPreference. This
covers the main requirements of this method including listener
functionality.

Bug: 176495594
Bug: 177101287
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I8d318ab07785e52dd84d6261fdea8f318dce9bc5
2021-02-11 20:38:18 -08:00
Remi NGUYEN VAN
5027ebbfcb Revert "[VCN07] Bypass VCN for non-internet app accessible cellu..."
Revert submission 1579872-vcn07

Reason for revert: Possible culprit for b/179768816, broken ConnectivityControllerTest
Reverted Changes:
Id09b19c13:Address comments on aosp/1550755
I245bd69e0:[VCN07.1] Add test for bypassing VCN for non-inter...
I9936894b9:[VCN07] Bypass VCN for non-internet app accessible...

Change-Id: Ie5f8c3051fed40623e5d4705ac2243ef51a898bd
2021-02-12 04:09:15 +00:00
Treehugger Robot
af1216208b Merge "Stop using Slog in QosCallbackTracker." 2021-02-12 04:03:12 +00:00
Lorenzo Colitti
dd10764cf8 Stop using Slog in QosCallbackTracker.
This is not public API. Use Log instead.

Test: m
Fix: 172050541
Change-Id: I281831431e2edcf9a3b77122ad8736b94aa8e215
2021-02-12 01:40:06 +00:00
Lorenzo Colitti
4777edca7c Check registering system default callback needs NETWORK_SETTINGS.
Also address a code review comment.

Bug: 173331190
Test: test-only change
Change-Id: Ia68f482af6d10af203bdbd4e14a12ae0b12bb6b5
2021-02-12 01:12:48 +09:00
Lorenzo Colitti
cd67529417 Move VPN code from ConnectivityService to VpnManagerService.
ConnectivityService itself does not depend on mVpns or the Vpn
class any more. Most of this CL is simply moving code from one
class to another:

- Move the AIDL calls from IConnectivityManager to IVpnManager.
- Move the implementation from ConnectivityService to
  the new VpnManagerService.
- Move the APIs from ConnectivityManager to VpnManager, but
  temporarily maintain some shims in ConnectivityManager for the
  moved calls so that existing callers do not have to be modified
  in this CL.
- Update VpnService to call IVpnManager instead of
  IConnectivityManager.
- Move the code that registers the VpnManager service from
  ConnectivityFrameworkInitializer to SystemServiceRegistry.

Bug: 173331190
Test: atest HostsideVpnTests FrameworksNetTests CtsNetTestCases
Change-Id: I4911e2144df721a94fa00da9edf0dc372a7091c2
2021-02-12 01:12:24 +09:00
Lorenzo Colitti
ee1740ddf1 Add a skeleton VpnManagerService, and start it on boot.
This adds a lot of unused code but this should make it easier to
review subsequent CLs.

Bug: 173331190
Test: builds, boots, "dumpsys vpnmanager" succeeds
Change-Id: Ied379654a0c3ab6242d3125661fe30f322395059
2021-02-12 01:07:29 +09:00
Lorenzo Colitti
bcd692fdc9 Convert LockdownVpnTracker to NetworkCallbacks.
This will allow moving LockdownVpnTracker from the connectivity
to the VPN code. This requires moderate refactoring since it's
pretty tightly coupled to both.

In this CL:

1. Add an @hide API to tell ConnectivityService that legacy
   lockdown VPN is enabled. I chose not to use the existing
   setVpnRequiredForUids API because that method has specific
   semantics and because it will be required long term since
   it's used by non-legacy VPN types.

2. Instead of updating LockdownVpnTracker inline from the
   ConnectivityService handler thread, have it listen to
   NetworkCallbacks. This introduces an extra thread hop, but
   most of the interactions between the lockdown VPN and CS were
   via NetworkAgent, which is asynchronous anyway.

3. Add code to LegacyTypeTracker to send the extra
   CONNECTIVITY_ACTION broadcast for the underlying network type
   that is sent after the VPN connects. In order to do this, make
   Make LockdownVpnTracker specify its underlying network
   (via setUnderlyingNetworks) when it connects.

4. Reimplement LockdownVpnTracker#augmentNetworkInfo based on
   information that is available in ConnectivityService.

5. Remove the code in LockdownVpnTracker that counted errors.
   I think this code has not worked since lollipop, because
   ConnectivityService never sees NetworkInfo objects in state
   FAILED. This is because ConnectivityService only hears about
   NetworkInfo objects via NetworkAgents, and LegacyVpnRunner
   only registers its NetworkAgent when the connection succeeds.

Bug: 173331190
Test: passes existing tests in ConnectivityServiceTest
Change-Id: I66d18512882efd468ee0ecec61f28786a195b357
2021-02-12 01:07:29 +09:00
Lorenzo Colitti
9f38060e30 Minor fixes to VpnTransportInfo.
This CL addesses comments on aosp/1570921.

Bug: 173331190
Test: new test coverage
Change-Id: Ie8e1bd63bb818a03f4b17402e1b365577ca034a2
2021-02-11 23:28:00 +09:00
Roland Levillain
7b74bf7681 Merge changes from topic "int32ref" am: 5cc3c631e5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1566390

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I86dde2fef971759b4720cfb242e8954baacf9d84
2021-02-11 12:43:56 +00:00
Roland Levillain
5cc3c631e5 Merge changes from topic "int32ref"
* changes:
  [Mainline] android.system package APIs migration
  Use public android.system.Int64Ref instead of Int32Ref which is hidden (CorePlatformApi) type of libcore
2021-02-11 12:05:36 +00:00
Yan Yan
8704fddbc1 Update underlying network of IpSecTunnelInterface
Bug: 169855650
Test: atest IpSecManagerTunnelTest
Change-Id: I6d1b8d0e49f89c67ddc2caf4ba63fb0b1eb062c0
2021-02-10 14:51:43 -08:00
Hai Shalom
a7579b2e41 Merge "Support for Terms & Conditions notification" am: ead8991fbb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1557451

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibabb4e549706c5ab263aab9df78c9e5a0bff95de
2021-02-10 15:40:25 +00:00
Hai Shalom
ead8991fbb Merge "Support for Terms & Conditions notification" 2021-02-10 15:36:58 +00:00
Serik Beketayev
915ad3be79 [Mainline] android.system package APIs migration
By removing Int32Ref.

Bug: 177619520
Bug: 179703584
Test: mma
Change-Id: I9b63146ae563ed977f3112c9910f7a7c575de0b8
Merged-In: I9b63146ae563ed977f3112c9910f7a7c575de0b8
(cherry picked from commit 63be51447826b077a1048901bb1aa73adb321ee1)
2021-02-10 12:34:46 +00:00
Lorenzo Colitti
2d2af92aca Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo" am: 5597c03563
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1572981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I83b4210780cf87006be5f55439ade06cd7893530
2021-02-10 06:55:56 +00:00
Lorenzo Colitti
5597c03563 Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo"
* changes:
  Stop using mVpns in getConnectionOwnerUid.
  Add a VpnTransportInfo object.
  Add a registerSystemDefaultNetworkCallback method.
2021-02-10 06:38:41 +00:00
Lorenzo Colitti
a5a903d0b5 Stop using mVpns in getConnectionOwnerUid.
Use data that is already available in ConnectivityService
instead.

The behaviour of the new implementation is slightly different
from Q and R code when the permission check fails.

- The old code would throw a SecurityException if an app that
  was not an active VPN called the method, and would return
  INVALID_UID if the connection belonged to a UID that was not
  subject to the VPN.
- The new code returns INVALID_UID in both cases.

This does not seem like a compatibility problem. The only case in
which the code throws SecurityException is if the app is not a
current VPN app, but the app already knows whether it is or not.
The docs don't mention that the method SecurityException, either.

Bug: 173331190
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
Change-Id: If3d031e74df33b5c97e12ebf02272faac6769d50
2021-02-10 02:52:16 +09:00
Lorenzo Colitti
31a31193d2 Add a VpnTransportInfo object.
This currently stores the VPN type and a session name, but can be
extended in the future.

Bug: 173331190
Test: added coverage in VpnTest
Test: added coverage in ConnectivityServiceTest
Test: added coverage in NetworkAgentTest
Change-Id: I450858a9fa332c8d896dbdb4c14337d5ec23677f
2021-02-10 02:52:16 +09:00
Lorenzo Colitti
76b639e1bc Add a registerSystemDefaultNetworkCallback method.
This method allows internal components to track the system
default network. This differs from registerDefaultNetworkCallback
because that method sends callbacks for the default network for
the UID that called it. This may not be the system default
network, for example, when a VPN is up and applies to the UID.

Bug: 173331190
Test: new unit tests in ConnectivityServiceTest
Test: new unit tests in ConnectivityManagerTest
Test: new CTS tests in ConnectivityServiceTest
Test: new CTS tests in HostsideVpnTests in other CL in this topic
Change-Id: Id02748a2183f71b71ff2a53a580466b9dcecaa93
2021-02-09 20:58:28 +09:00
Junyu Lai
767bc898e1 Merge changes from topic "removeNI" am: bb44ed9da9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536707

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia7c6e3bf8f10b98fc2c4d83d41e65c64737753f0
2021-02-09 04:26:28 +00:00
Junyu Lai
bb44ed9da9 Merge changes from topic "removeNI"
* changes:
  [FUI07] Stop making NetworkState with NetworkInfo from external callers
  [FUI06] Stop using NetworkInfo in NetworkState from external callers
2021-02-09 03:37:59 +00:00
Junyu Lai
8e9d9cbd6c Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" am: 43117b2a60
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549817

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I304db5e46d8e76d7248b9dd1f42b43200635b2be
2021-02-08 22:09:54 +00:00
Junyu Lai
43117b2a60 Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" 2021-02-08 21:40:09 +00:00
Hai Shalom
7c6ab4004a Support for Terms & Conditions notification
- Added API to add T&C URL in the CaptivePortalData class, and to
indicate if the source is from Passpoint.
- Added source indication for the Venue URL API.
- Allow the connectivity service to send a new T&C acceptance
notification.
- Updated the merge method to prefer the Capport data over the
network agent data, if the source is not authenticated (not from
Passpoint).
- Propagate the Venue Friendly name to the captive portal activity
to be used instead of SSID, when available.

Bug: 162785447
Test: End-to-end test
Test: atest ConnectivityServiceTest
Test: atest CtsNetTestCasesLatestSdk:CaptivePortalDataTest
Test: atest NetworkNotificationManagerTest
Change-Id: I4e77c3b6c01941b03c46ad32da70c77e0fecac64
2021-02-08 12:05:20 -08:00
Roshan Pius
ad75775f77 Merge "ConnectivityService: Plumb attribution tag for location permission checks" am: 482b2dda4f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1534625

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5150c4827d8d2a8154afdf4f7076846fe6e38630
2021-02-08 19:26:46 +00:00
Roshan Pius
aa24fdeb5d ConnectivityService: Plumb attribution tag for location permission checks
Not currently setting the atttribution tag for location
permission checks. Plumb the attribution tag for all location permision
checks (so that location access is correctly attributed to individual
components within an app)

Bug: 162602799
Test: atest android.net
Test: atest com.android.server
Change-Id: Iee95f05204f51a4f8cb1f36acfb60e8cdeb156f4
2021-02-08 08:13:48 -08:00
junyulai
23e22618cf [FUI07] Stop making NetworkState with NetworkInfo from external callers
Follow-up from previous patch. This change stop accessing the
constructor that needs NetworkInfo to create NetworkState, which
is no longer accessible after ConnectivityService become
mainline module. Instead, pass a legacy network type which is
dedicated for the need of the type.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I24157bc33e5a5819eccd6a3111d2049f531c1d43
2021-02-08 21:58:02 +08:00
junyulai
d49aab92c9 [FUI06] Stop using NetworkInfo in NetworkState from external callers
This is achieved by:
  1. Use legacy network type inside NetworkState to replace the
     needs of referencing NetworkInfo.getType().
  2. Let getAllNetworkState only return networks with isConnected()
     equals true. This allows callers such as NPMS or NSS does not
     have to reference to NetworkInfo.isConnected().

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I1c4eb08d18ca973eb8f41d06258872eabc0006b8
2021-02-08 21:40:49 +08:00
Lorenzo Colitti
e366ee833b Merge changes I4256ca5f,I91528e1a,I48bd594c am: c4e50c9c50
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579985

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic761cd9e8e492bcbde117f2b7de7f995b93ea0e7
2021-02-08 11:21:08 +00:00
Chiachang Wang
eb41408093 Merge "Move shared Proxy method and constants to shared lib" am: bf911c0f3c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574816

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4c6ff3c4c82d12334b52871863cc7d6d5c6872c9
2021-02-08 11:00:55 +00:00
Lorenzo Colitti
c4e50c9c50 Merge changes I4256ca5f,I91528e1a,I48bd594c
* changes:
  Change ConnectivityServiceTest to prepare for VPN code move.
  Add to VpnManager the VPN APIs used by Settings and SystemUI.
  Remove temporary hack in VpnTest.
2021-02-08 10:41:32 +00:00
Chiachang Wang
bf911c0f3c Merge "Move shared Proxy method and constants to shared lib" 2021-02-08 10:27:05 +00:00
Chiachang Wang
ab9f017af4 Move shared Proxy method and constants to shared lib
The static validate() method an PROXY_* constants in Proxy are
used by both module and Settings. After Proxy is moving into
connectivity module, Setting will not able to access them.
Thus, move them to ProxyUtils in net shared lib.

Bug: 172183305
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases:ProxyInfoTest
Change-Id: I02c88aeaeb53d62b87a42a2d8ead9b140b054650
2021-02-08 10:25:07 +00:00
Treehugger Robot
543e00a3f8 Merge "[VCN03] Linger the newly connected network for a short time" am: 819f6638a8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1527820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icabf50b92925fe3bcb5b45e40cc1c696c73e7380
2021-02-08 05:19:15 +00:00
Treehugger Robot
819f6638a8 Merge "[VCN03] Linger the newly connected network for a short time" 2021-02-08 04:57:35 +00:00
Chiachang Wang
fd30b4f5ce Merge "Create new system API in UserHandle to get uid" am: e0a1006f6c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1573942

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia8303c08be1e76ff48e60965518de4d469dc0352
2021-02-08 04:30:03 +00:00
Chiachang Wang
e0a1006f6c Merge "Create new system API in UserHandle to get uid" 2021-02-08 03:56:39 +00:00
Lorenzo Colitti
d24945fb08 Merge "More cleanly separate requests and listens." am: 660e3f4b29
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1565202

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia7ed944bb1c2b81dd3f6ff74c195a3bc5f22ea51
2021-02-07 18:29:52 +00:00
Lorenzo Colitti
660e3f4b29 Merge "More cleanly separate requests and listens." 2021-02-07 18:04:50 +00:00
Lorenzo Colitti
af17de03ce Change ConnectivityServiceTest to prepare for VPN code move.
No-op changes to make it easier to review the VPN code move.
1. Set underlying networks via MockVpn, not ConnectivityService.
2. Add a processBroadcastForVpn utility method that we can modify
   without too much churn when the code is moved.

Bug: 173331190
Test: test-only change
Change-Id: I4256ca5f33034ef9d1de79857795a6ed1d644e61
2021-02-07 20:40:52 +09:00
Lorenzo Colitti
f80ad439dd Add to VpnManager the VPN APIs used by Settings and SystemUI.
Settings and SystemUI use these through raw AIDL calls.
Make them proper manager calls so we can move the implementation
without touching the callers again.

For now these still call into ConnectivityService via
IConnectivityManager. In an upcoming CL the implementation will
move to VpnManagerService.

Test: m
Bug: 173331190
Change-Id: I91528e1ad9948fbaa1fc5e37c61c5eb95f54964e
2021-02-07 20:40:51 +09:00
Lorenzo Colitti
e9192a51f4 Remove temporary hack in VpnTest.
This temporary hack was necessary due to b/175883995. Now that
that bug is fixed, remove the hack.

Bug: 171529940
Test: test-only change
Change-Id: I48bd594cf3a37575f4888c1be9a1cf535de2e4d2
2021-02-07 20:40:46 +09:00
Lorenzo Colitti
96742d9695 More cleanly separate requests and listens.
Currently, NetworkRequest has several types of requests (LISTEN,
TRACK_DEFAULT, REQUEST, BACKGROUND_REQUEST), and we expect more
to be added.

There are really three categories of request:
1. Requests satisfied by only one network and will keep that
   network up, and thus need to be sent to NetworkProviders:
   REQUEST, BACKGROUND_REQUEST.
2. Requests satisfied by only one network but will not keep that
   network up: TRACK_DEFAULT
3. Requests satisfied by multiple networks and will not keep any
   networks up: LISTEN.

Unfortunately the separation is not very clear. Currently, for
any valid request, either isListen() will return true or
isRequest() will return true. This makes it impossible to tell
whether a particular request should be sent to NetworkProviders,
so the current code sends TRACK_DEFAULT requests to
NetworkProviders as well. This is incorrect - a TRACK_DEFAULT
should never keep a network up, for example.

This CL attempts to clarify things by making isRequest() return
false for TRACK_DEFAULT requests and thus never sending them to
NetworkProviders. After this CL:

- isRequest will return true only for requests that attempt to
  bring up or keep up a network.
- isListen will return true only for requests that match multiple
  networks but do not keep any of them up.
- Neither will return true for TRACK_DEFAULT.

Test: atest ConnectivityServiceTest
Change-Id: I7aad30ade8f7ab2a179e53483d9afd8675f64a12
2021-02-07 18:20:59 +09:00