Commit Graph

56 Commits

Author SHA1 Message Date
Lorenzo Colitti
3bf6f17d7b Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63 am: d18e61a6d1 am: a7a858e42a am: ed9730e6f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1581293

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I698b6b082b121c004b2c8b05ef423da1bd8b871b
2021-02-15 01:32:50 +00:00
Lorenzo Colitti
d18e61a6d1 Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63
* changes:
  Check registering system default callback needs NETWORK_SETTINGS.
  Move VPN code from ConnectivityService to VpnManagerService.
  Add a skeleton VpnManagerService, and start it on boot.
  Convert LockdownVpnTracker to NetworkCallbacks.
  Minor fixes to VpnTransportInfo.
2021-02-15 00:00:47 +00:00
James Mattis
1be5c805d6 Merge changes from topics "pans", "pans-permission" am: 601d16a336 am: 700e969359 am: 6c16aeadfb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1561317

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20fdb2f06b473f9f92e62138e72bd30d4384a267
2021-02-14 09:51:16 +00:00
James Mattis
6e2d702d37 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
a46c144617 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
12aeab88bd 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
Lorenzo Colitti
842075ed8e 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
d97b404c48 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
c71cff8837 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
Hai Shalom
e3d5ac6fda Merge "Support for Terms & Conditions notification" am: f668290356 am: d6cceec670 am: 4e0c1992db
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1557451

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0a47d12f41b9247910078ec8d6cd6e1f1589956e
2021-02-10 16:55:42 +00:00
Hai Shalom
f668290356 Merge "Support for Terms & Conditions notification" 2021-02-10 15:36:58 +00:00
Lorenzo Colitti
b88e53c5ee Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo" am: 250855cb84 am: 0db7e3cd40 am: 32942ed2a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1572981

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I961b6442d53c1cb00af642866b7e49d151a9ab1e
2021-02-10 07:46:14 +00:00
Lorenzo Colitti
026fbb8a1f 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
a77d05ec0a 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
76fd2e1c99 Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" am: e0b730d4cf am: f300258bf1 am: 07c1f36651
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549817

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I915ba6692ebae6ae09429d515ef612fdd48590f8
2021-02-08 22:37:06 +00:00
Roshan Pius
e603f82db9 Merge "ConnectivityService: Plumb attribution tag for location permission checks" am: 482b2dda4f am: de46bf6d23 am: 94404471df
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1534625

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I72340de13e04640935403d282a1d9f5afe0536e6
2021-02-08 21:40:29 +00:00
Junyu Lai
e0b730d4cf Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" 2021-02-08 21:40:09 +00:00
Hai Shalom
7c85e7d4d6 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
a8a477b84e 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
Lorenzo Colitti
d300790a1e Merge changes I4256ca5f,I91528e1a,I48bd594c am: cdb5fbfbc2 am: b20a56035c am: 1ea2b93620
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579985

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7201b62010a56962a16a89bb43cbde75cda22e14
2021-02-08 12:13:23 +00:00
Chiachang Wang
efbd4ca104 Merge "Move shared Proxy method and constants to shared lib" am: 201e7e9721 am: 185a47e799 am: 2fb35058f8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574816

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8bf2cb335d4154749e69147e9c549e1be548e8a3
2021-02-08 12:12:48 +00:00
Lorenzo Colitti
cdb5fbfbc2 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
201e7e9721 Merge "Move shared Proxy method and constants to shared lib" 2021-02-08 10:27:05 +00:00
Chiachang Wang
f151290e0c 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
Lorenzo Colitti
399ef75768 Merge "More cleanly separate requests and listens." am: d301e60ccf am: 1ffc1b670f am: 580ed937dd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1565202

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I859c265fb73352cc8e0c2db5cdd119644c230dd3
2021-02-07 19:52:03 +00:00
Lorenzo Colitti
d301e60ccf Merge "More cleanly separate requests and listens." 2021-02-07 18:04:50 +00:00
Lorenzo Colitti
d9a569fd4a 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
7a0f31b944 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
James Mattis
8ca55b6b98 Merge changes Iabad7300,I85363e28 am: e3e711d775 am: 257651846b am: 5362c1b0b7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1539241

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I05f6ae928a5bfa8b56837fa5c55803b2233d36a1
2021-02-06 06:07:15 +00:00
James Mattis
e3e711d775 Merge changes Iabad7300,I85363e28
* changes:
  Stubbed setOemNetworkPreference in Connectivity
  Update OemNetworkPreferences to use 1:1 Map
2021-02-06 04:33:51 +00:00
Remi NGUYEN VAN
ded18b9d13 Merge "Remove legacy network factories" am: 2bd97d70e2 am: 05a710816f am: df1860329b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574684

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I04893919701674bdaec026a14207bfb350a3cd08
2021-02-05 10:50:14 +00:00
Treehugger Robot
6a84d58b7f Merge "Add @Nullable to Object#equals()" 2021-02-05 09:36:41 +00:00
Remi NGUYEN VAN
2bd97d70e2 Merge "Remove legacy network factories" 2021-02-05 08:23:19 +00:00
Roman Kalukiewicz
0b6f2908c5 Add @Nullable to Object#equals()
This is a partial cherry-pick of change:
I5eedb571c9d78862115dfdc5dae1cf2a35343580

for connectivity classes.

Bug: 170883422
Test: m
Merged-In: I5eedb571c9d78862115dfdc5dae1cf2a35343580
Change-Id: I7dc661863b73f4198ddb4f3a1566583d0f07db3c
2021-02-05 07:28:44 +00:00
James Mattis
452c6ffa61 Stubbed setOemNetworkPreference in Connectivity
Stubbed setOemNetworkPreference() in ConnectivityService and connected
it to ConnectivityManager.

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

Change-Id: Iabad7300a8b058e1edcb0defab8a031d21e6433c
2021-02-04 20:12:40 -08:00
Adrian Roos
359549af2f API: Suppress existing NullableCollections lints am: 515b26ae98 am: b59b4d91dc am: 98eb82a6d3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1566096

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I314b97d2677f26b0a9c09a52918df49096450aea
2021-02-04 17:09:38 +00:00
Adrian Roos
b59b4d91dc API: Suppress existing NullableCollections lints am: 515b26ae98
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1566096

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2d47151b7e26e82706f2d94a13c4067fe71fc168
2021-02-04 16:19:34 +00:00
Adrian Roos
d667ef7737 Merge changes from topic "nullablecollection"
* changes:
  API: Suppress existing NullableCollections lints (TaskOrganizer)
  API: Suppress existing NullableCollections lints
2021-02-04 15:53:34 +00:00
junyulai
062b648099 [VCN07] Bypass VCN for non-internet app accessible cellular services
Deduce the NET_CAPABILITY_NOT_VCN_MANAGED capability from other
capabilities and user intention, which includes:
   1. For the requests that don't have anything besides
      VCN_SUPPORTED_CAPABILITIES, add the NOT_VCN_MANAGED to
      allow the callers automatically utilize VCN networks
      if available.
   2. For the requests that explicitly add or remove
      NOT_VCN_MANAGED,  do not alter them to allow user fire
      request that suits their need.

Test: atest NetworkRequestTest#testBypassingVcnForNonInternetRequest
Bug: 175662146
Change-Id: I9936894b9530a22fb186cfd25cbee0fced65b72b
2021-02-04 17:07:23 +08:00
Remi NGUYEN VAN
470efc161d Remove legacy network factories
Nothing on the system is using registerNetworkFactory,
unregisterNetworkFactory at the moment.

registerNetworkFactory, unregisterNetworkFactory are protected by
signature permissions, so could not be used by anything outside of the
system.

Remove the two methods and the underlying support for this legacy,
deprecated mechanism.

Bug: 179229316
Test: atest FrameworksNetTests
Change-Id: I7cdc9eed67f846c8774474af038133040aeccab3
2021-02-04 18:04:43 +09:00
Lucas Lin
ddb24b3095 Merge "Reimplement [read|write]ArraySet of Parcel inside NetworkCapabilities" am: d88ef71aa4 am: a1eb910ead am: 6e81f01538
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556547

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3ad30835e454c5003b36d0a87e0c34c88b2438bf
2021-02-04 08:18:40 +00:00
Lucas Lin
d88ef71aa4 Merge "Reimplement [read|write]ArraySet of Parcel inside NetworkCapabilities" 2021-02-04 06:12:14 +00:00
Remi NGUYEN VAN
a1aefffd2d Merge "Use formal API for ActivityThread to set proxy" into sc-dev 2021-02-04 02:44:38 +00:00
Remi NGUYEN VAN
8a831d6e07 Use formal API for ActivityThread to set proxy
Add getProxyForNetwork to the public API, and use ConnectivityManager
APIs from ActivityThread (instead of hidden APIs) to get/set the proxy
for an app process.

getProxyForNetwork allows clients to find which proxy applies, which can
be a global proxy setting or a per-network proxy.

The default proxy is now initialized with getDefaultProxy instead of
getProxyForNetwork(null); this should not make a difference, as nothing
should have called bindProcessToNetwork at that point yet.

Bug: 174436414
Test: m; device boots
Change-Id: Ifb516194ecde1567cea4b6806946091cdcf2f015
2021-02-03 10:19:25 +09:00
Junyu Lai
74418fde45 Merge "[VCN08] Expose NOT_VCN_MANAGED capability as system API" am: fc1622a827 am: 2562ab4856 am: b57e9b2dcc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1563497

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I932566b4bb788925072e57436cd5f5fa7918a32c
2021-02-02 15:58:36 +00:00
Junyu Lai
fc1622a827 Merge "[VCN08] Expose NOT_VCN_MANAGED capability as system API" 2021-02-02 13:57:57 +00:00
Paul Hu
67c41a05dd Merge "Remove ArrayUtils usage in connectivity frameworks classes" am: 7cd199f07b am: ace78186e4 am: 0ca0316937
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1564776

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia926472336a8abfa6583f29f452838056db932a8
2021-02-02 10:09:24 +00:00
Paul Hu
7cd199f07b Merge "Remove ArrayUtils usage in connectivity frameworks classes" 2021-02-02 08:47:04 +00:00
Treehugger Robot
0d837effb9 Merge "Have connectivity self-register manager classes" am: d8c4953e7e am: 98c48f7101 am: f99ed40471
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552657

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7a664bb9e9f2f835f148d0102f8b53c010bb7791
2021-02-02 06:40:07 +00:00
lucaslin
f4a7b149c1 Reimplement [read|write]ArraySet of Parcel inside NetworkCapabilities
Both of readArraySet and writeArraySet are hidden APIs inside
Parcel, so reimplement those two methods inside NetworkCapabilities
to prevent calling hidden APIs.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I70f75c1a0db92c6a5575c6a9917843d783dfaeea
2021-02-02 12:57:26 +08:00