Commit Graph

2004 Commits

Author SHA1 Message Date
Lorenzo Colitti
3d397dbd72 Merge changes I0e6df469,I3d46d5f7 am: 05baf850c4 am: 263ead791b am: 8f5de657a6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1591457

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I44e26cb8d6e8071c7467316bfb60047d1ea10a22
2021-02-19 09:40:14 +00:00
Lorenzo Colitti
6450ad656d Merge "Fix all Log.wtfs in FrameworksNetTests." am: 326cf02637 am: f8b5e2a497 am: fb0f6ac08b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1591458

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I715658a8f15dada6fd0f248d897d2bc294bacf1a
2021-02-19 09:39:11 +00:00
Lorenzo Colitti
05baf850c4 Merge changes I0e6df469,I3d46d5f7
* changes:
  Fix testMobileDataAlwaysOn flakiness
  Speed up NetworkFactory tests.
2021-02-19 08:13:38 +00:00
Lorenzo Colitti
cf4fb16228 Fix all Log.wtfs in FrameworksNetTests.
These cause the tests to crash on eng builds, so disrupt
development.

Test: atest FrameworksNetTests passes on eng build
Change-Id: Ifa5131fdb8f57af812cf688970be6588d2879c29
2021-02-18 21:13:04 +09:00
Chalard Jean
1cd19ed4cb Fix testMobileDataAlwaysOn flakiness
Test: atest --iterations 100 CST#testMobileDataAlwaysOn
Change-Id: I0e6df4694752dab7a5938e8f8bd88c7da7c3fcd5
2021-02-18 16:45:27 +09:00
Chalard Jean
3d8d563e24 Speed up NetworkFactory tests.
Somehow this big slowdown escaped review.

Test: ConnectivityServiceTest
Change-Id: I3d46d5f7a986b3586b7e6044eb10aba756bb6ceb
2021-02-18 16:45:26 +09:00
Lorenzo Colitti
8e97e8b968 Merge "Fix merge conflict." 2021-02-18 05:22:56 +00:00
James Mattis
3af4b83480 Merge "Unit test automation for Per-App API functionality" am: eed1a0000b am: f0cfa51361 am: 0db660f54c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1562555

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I559adbea15bef817f5f258e38597d169307c6f65
2021-02-17 19:45:57 +00:00
Lorenzo Colitti
0d40ddb1ef Fix merge conflict.
ag/13210542 was submitted directly into internal and is causing
a merge conflict in NetworkNotificationManagerTest.

Fix the conflict by adding the unused imports.

Test: m
Bug: 175409684
Change-Id: I6eec459a5e5b9900ddeb9e17d90f07432eee1394
2021-02-17 20:22:35 +09:00
James Mattis
5ee5d5d28a Unit test automation for Per-App API functionality
Unit test automation for setOemNetworkPreference() API functionality on
ConnectivityService.

Bug: 178632672
Bug: 176494815
Bug: 170068946
Test: atest FrameworksNetTests
Change-Id: Ib76917f0fa78b736207f82d99137a6cf49481b20
2021-02-17 08:55:20 +00:00
Lorenzo Colitti
5ffeed6200 Merge "Use UserHandles instead of userId integers." am: f2abf2692c am: 883841d201 am: 4ff8cf6391
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1589632

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8b6bdedc099cb421b52dd35b4ccfdfaf0d9c9633
2021-02-17 02:53:29 +00:00
Lorenzo Colitti
0e9d2108b0 Use UserHandles instead of userId integers.
userId integers are not public API and code should use UserHandle
instead.

Bug: 170598012
Test: passes existing tests
Change-Id: Ic27b93ccfe6bbc97e7419293ce165fee6cd51e6d
2021-02-16 08:06:23 +00:00
Remi NGUYEN VAN
2766d615e6 Merge "Revert "[VCN07] Bypass VCN for non-internet app accessible cellu..."" am: 75049d8ec8 am: 0ee35089b7 am: 96f21fd65f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1585569

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I88648d8cab6081c178ecdd3b38935658a78b78dc
2021-02-16 02:23:51 +00:00
Lorenzo Colitti
9cdb79d634 Merge "BroadcastInterceptingContext: use passed-in broadcast Handler." am: b3ce8c39d8 am: 3d2c5d6774 am: 11eae148c4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1589251

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5d38e78800c9a524ae7ccf5d55ebae1a9f60922f
2021-02-15 12:08:03 +00:00
Remi NGUYEN VAN
75049d8ec8 Merge "Revert "[VCN07] Bypass VCN for non-internet app accessible cellu..."" 2021-02-15 11:39:25 +00:00
Lorenzo Colitti
37d17e60c3 BroadcastInterceptingContext: use passed-in broadcast Handler.
Currently, BroadcastInterceptingContext always runs broadcast
receivers on the thread that called sendBroadcast. This means:

1. Receivers might run on the wrong thread, making the test less
   realistic.
2. If any receiver checks what thread it's running on, then
   either the check needs to be modified or deleted, or the test
   must call sendBroadcast on the thread that the receiver
   expects to run on. The latter is impossible when there is more
   than one receiver that needs to run on more than one thread.

This CL adds a setUseRegisteredHandlers method that allows tests
to say that they want each receiver to run on the Handler
specified at registration time.

This CL also enables the new mode for ConnectivityServiceTest,
and resolves a TODO to re-enable a disabled thread check.

The new mode cannot be enabled by default because it would break
most of the tests.

All the below tests pass except for the car bluetooth test
testAutoConnectAdapterOff_returnsImmediately which was already failing.

Bug: 173331190
Test: atest CarInputServiceTest BluetoothProfileDeviceManagerTest
Test: atest NetworkPolicyManagerServiceTest
Test: atest ConnectivityServiceTest
Test: atest TetheringTest TetheringNotificationUpdaterTest
Test: atest VersionedBroadcastListenerTest EntitlementManagerTest
Test: atest TetheringConfigurationTest
Test: atest CachedDeviceStateServiceTest
Test: atest EmergencyAffordanceServiceTest
Change-Id: I3303bb14516f07a55d82a16b59c111ab3f8b0389
2021-02-15 10:40:32 +00:00
Lorenzo Colitti
f22aa33bc6 Merge changes Ia68f482a,I4911e214,Ied379654,I66d18512,Ie8e1bd63 am: 6e423b8024 am: f390bd61d7 am: 321e1c1f6a
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
6e423b8024 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
Yan Yan
3d818137f3 Merge changes Ifc8ad902,I6d1b8d0e am: 87c6253518 am: 66b74e588b am: 913569d3e5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1453730

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6f3235dd38e4c4912f986cbb27867ff14fe38e81
2021-02-12 22:46:32 +00:00
Remi NGUYEN VAN
54bb81ba9a 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
Lorenzo Colitti
d5e9f98e28 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
0dd4b6f512 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
549e9acd92 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
720f3cc167 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
Yan Yan
00387a2654 Update underlying network of IpSecTunnelInterface
Bug: 169855650
Test: atest IpSecManagerTunnelTest
Change-Id: I6d1b8d0e49f89c67ddc2caf4ba63fb0b1eb062c0
2021-02-10 14:51:43 -08:00
Hai Shalom
f578bf4914 Merge "Support for Terms & Conditions notification" am: 67bb51ec40 am: fed30f42e8 am: b5a72aa56d
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
67bb51ec40 Merge "Support for Terms & Conditions notification" 2021-02-10 15:36:58 +00:00
Lorenzo Colitti
6c9655f273 Merge changes from topics "vpnmove-getconnectionowneruid", "vpnmove-systemdefaultcallback", "vpnmove-vpntransportinfo" am: 5e21b83410 am: 5eac15c044 am: 22b1c63d51
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
5e21b83410 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
bd015f4861 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
523b5e8405 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
80b48bc589 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
6251da61be Merge changes from topic "removeNI" am: c60c7b4df8 am: c62d1e3b0c am: ecac1d2479
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536707

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3553ff41d85f44c481ea065e6cbda5d286f9e1fa
2021-02-09 05:49:15 +00:00
Junyu Lai
c60c7b4df8 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
db59cf7731 Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" am: f1d8c34877 am: f3e868f4d0 am: e9fe15bfe1
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
8e9626ed47 Merge "ConnectivityService: Plumb attribution tag for location permission checks" am: 482b2dda4f am: cef5161a27 am: bd0120da19
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
f1d8c34877 Merge "[VCN07] Bypass VCN for non-internet app accessible cellular services" 2021-02-08 21:40:09 +00:00
Hai Shalom
7fcd18ae0b 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
c97d806148 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
aabc564902 [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
dddf2b6a02 [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
c55563a045 Merge changes I4256ca5f,I91528e1a,I48bd594c am: 82c60d022d am: afa74de47d am: 909af3ded7
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
Lorenzo Colitti
82c60d022d 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
Treehugger Robot
41eda8d96a Merge "[VCN03] Linger the newly connected network for a short time" am: c5bd380f2b am: 733561ba51 am: d405f3a995
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1527820

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I048c81620a3ad4af481c43d27de10f92ca4fb18c
2021-02-08 05:59:15 +00:00
Treehugger Robot
c5bd380f2b Merge "[VCN03] Linger the newly connected network for a short time" 2021-02-08 04:57:35 +00:00
Lorenzo Colitti
852baaab79 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
a6e7006967 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
junyulai
f6d98ec185 [VCN03] Linger the newly connected network for a short time
This is mainly used by VCN, where VCN-eligible networks might
be registered before VCN management service can fire request
to prevent the newly created network from being torndown
immediately by ConnectivityService.

Test: atest ConnectivityServiceTest#testNewNetworkLingering
      atest ConnectivityServiceTest#testNewNetworkLingering_bgNetwork
      atest FrameworksNetTests --rerun-until-failure 20
Bug: 175180558
Change-Id: I7768daf4cf2d8f6d8057b5107412e06104ba82e0
2021-02-06 11:22:31 +08:00
Aaron Huang
5b748de126 Merge "Update VpnTest for new restricted API" am: 20507cf1f9 am: 1fb754cc9c am: 4bec1c714d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554177

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9188685fe0bb5ee7dfe2c0538fea6644b2cd642e
2021-02-05 12:50:16 +00:00
Aaron Huang
20507cf1f9 Merge "Update VpnTest for new restricted API" 2021-02-05 10:52:54 +00:00