Commit Graph

12252 Commits

Author SHA1 Message Date
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
lucaslin
da109c0066 Remove unused INetworkManagementService from IpSecService
IpSecService is no longer using any methods of
INetworkManagementService, so remove it from IpSecService
and related files.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I852e3a534e0ffd26b4b22420754f3ec8a6f153ad
2021-02-08 08:05:00 +00:00
lucaslin
aff5af21fa Use NetdUtils instead of NetworkManagementService in Vpn
NetdUtils has the same method(e.g. setInterfaceUp) as
NetworkManagementService so using the one inside NetdUtils instead
and try to remove NetworkManagementService from Vpn in
the following commit.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I867556478fbc8c8ca8baa4e4c438a47b3beebe39
2021-02-08 16:03:19 +08:00
lucaslin
96059d1f82 Use NetdUtils instead of NetworkManagementService in IpSecService
NetdUtils has the same method(e.g. setInterfaceUp) as
NetworkManagementService so using the one inside NetdUtils instead
and try to remove NetworkManagementService from IpSecService in
the following commit.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I0ed8b0c678b067a655b51b938b6b40eadd985321
2021-02-08 16:01:56 +08: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
Serik Beketayev
575309005a Merge "Revert "[Mainline] Migrate android.utils package items"" am: 7370eb56b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579467

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I05e76b48f1e2ce22b04b5a05c0cb8a0fd71a103e
2021-02-07 03:55:21 +00:00
Serik Beketayev
7370eb56b6 Merge "Revert "[Mainline] Migrate android.utils package items"" 2021-02-07 03:11:47 +00:00
Serik Beketayev
47c4d4d91e Revert "[Mainline] Migrate android.utils package items"
Revert submission 1553146-android_util

Reason for revert: Build Breakage aosp-master/db845c-userdebug @ 7128996
Reverted Changes:
Ia39f6e03f:[Mainline] Migrate android.utils package items
Iaf99140d6:[Mainline] Migrate android.utils package items

Change-Id: I5bdaec5d1a87436510c3e05fadaf0124d86b1bdf
2021-02-06 09:19:47 +00:00
lucaslin
8e2112473a Expose TEST_TAP_PREFIX as system API
TestNetworkManager is a part of connectivity mainline module and
it is already a system API, but its constant - TEST_TAP_PREFIX
is hidden, so expose it for the callers inside framework.

Bug: 172183305
Test: make update-api
Change-Id: I7fc08be4a6ca6325d5b576b761afda17865cefaa
2021-02-06 09:11:05 +00:00
Serik Beketayev
b1b47dac53 Merge "[Mainline] Migrate android.utils package items" am: d41acb6e75
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552837

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I20f8a0ad33c592c799103d86f64e7755f54fa85a
2021-02-06 07:26:16 +00:00
Serik Beketayev
d41acb6e75 Merge "[Mainline] Migrate android.utils package items" 2021-02-06 07:00:12 +00:00
James Mattis
c0e65f82ea Merge changes Iabad7300,I85363e28 am: d15312ef50
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1539241

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6ff19fad0ddb74c3eccd7fb7d16214e483a3b8a7
2021-02-06 05:14:28 +00:00
Treehugger Robot
7528b50746 Merge "[Mainline] Core Platform APIs migration" am: 1b9888440e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1546370

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If0007ea53f7c4b4c1bbd0d397b848fb951278ec9
2021-02-06 05:04:31 +00:00
James Mattis
d15312ef50 Merge changes Iabad7300,I85363e28
* changes:
  Stubbed setOemNetworkPreference in Connectivity
  Update OemNetworkPreferences to use 1:1 Map
2021-02-06 04:33:51 +00:00
Treehugger Robot
1b9888440e Merge "[Mainline] Core Platform APIs migration" 2021-02-06 04:11:00 +00:00
junyulai
0ac374f7bd [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
287625271c Merge "Update VpnTest for new restricted API" am: ca0b4f05f3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554177

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I47baf5985f00722b5be3402668cfe7ff4942e6d1
2021-02-05 11:22:34 +00:00
Aaron Huang
ca0b4f05f3 Merge "Update VpnTest for new restricted API" 2021-02-05 10:52:54 +00:00
Treehugger Robot
1c2e5e00ac Merge "Add @Nullable to Object#equals()" am: 25def597ea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574815

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I523eb00d30bfedeb6e7533a94868016171846a59
2021-02-05 10:01:23 +00:00
Junyu Lai
b76743d297 Merge "[VCN09] Rename linger timer" am: 3d3ceb1985
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1571902

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0b69d6ac4d273b836c5ce36c79fc3ebb6c964634
2021-02-05 09:40:31 +00:00
Treehugger Robot
25def597ea Merge "Add @Nullable to Object#equals()" 2021-02-05 09:36:41 +00:00
Junyu Lai
3d3ceb1985 Merge "[VCN09] Rename linger timer" 2021-02-05 09:29:12 +00:00
Remi NGUYEN VAN
281541611d Merge "Remove legacy network factories" am: db50390d54
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574684

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I747f6352eb08589c00e77915eb17640e1d5f0ee1
2021-02-05 09:23:44 +00:00
Remi NGUYEN VAN
db50390d54 Merge "Remove legacy network factories" 2021-02-05 08:23:19 +00:00
junyulai
2b6f0c2d71 [VCN09] Rename linger timer
Linger timer mechanism will be used for both "linger" and
"nascent" states. To prevent confusion, rename the linger
timer and related functions to more generic name.

Test: TH
Bug: 175180558
Change-Id: I652f7c65c2f8bc58fb9d3316480f23a9709eccce
2021-02-05 15:57:07 +08:00
Lorenzo Colitti
836d7a4143 Merge changes Ieb7f33bc,I81b56862 am: 01a483ceec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1570920

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie0ef06663c31dfe16e0000410c9785ede9369212
2021-02-05 07:54:40 +00:00
Lorenzo Colitti
01a483ceec Merge changes Ieb7f33bc,I81b56862
* changes:
  Fix the legacy VPN tests that start racoon.
  Make testLegacyLockdownVpn more realistic.
2021-02-05 07:34:43 +00:00
Roman Kalukiewicz
384a8c63f2 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
Paul Hu
0959c42165 Merge "Replace NPMI#isUidNetworkingBlocked()" am: f5f52850f2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536313

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6c4b745fa67c8db72d04eb48582d06916f58902d
2021-02-05 07:01:42 +00:00
Paul Hu
f5f52850f2 Merge "Replace NPMI#isUidNetworkingBlocked()" 2021-02-05 06:38:02 +00:00
Lorenzo Colitti
dd53c5889b Fix the legacy VPN tests that start racoon.
These tests do not actually work, or at least not as designed.
What happens when they are run is that creating/connecting the
VPN throws an exception. The call to legacyRunnerReady.block()
times out after 10 seconds because the condition variable is
never opened, but the doesn't notice the timeout becasue it
doesn't check the return value of block().

There are two reasons for the VPN not coming up.
1. VpnConfig.getIntentForStatusPanel calls into PendingIntent and
   ActivityManager statics, which bypass all the mocks and fail
   with an appops denial. Fix this by making it a dependency.
2. The tests are broken due to the UserManager API changes
   tracked in b/175883995. Fixing by adding a bit of ad-hoc code
   into startLegacyVpn, with a TODO to delete it once the rest of
   the UserManager setup code is fixed.

Fix these and check the return value of block(). This ensures
that if any other breakage is added the test will actually fail.
Also check that the throw route survives all the way to the
LinkProperties sent to the agent.

Bug: 173331190
Test: atest com.android.server.connectivity.VpnTest
Change-Id: Ieb7f33bce283ac5ee562a912df8edb9c930ed2b0
2021-02-05 14:40:13 +09:00
Lorenzo Colitti
6d9fd406d4 Make testLegacyLockdownVpn more realistic.
Bug: 173331190
Test: test-only change
Change-Id: I81b5686244f479d967c826e29eba4feb396a09cf
2021-02-05 14:36:54 +09:00
James Mattis
47db058602 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
James Mattis
e74935d4e6 Update OemNetworkPreferences to use 1:1 Map
Updated OemNetworkPreferences to use a Map instead of an Array of Arrays
(SparseArray<List<String>>). This is for two reasons: to make the API
simpler and also prevent issues with duplicate entries for packages
mapped to more than one preference which is not supported.

Bug: 176597181
Bug: 176494815
Test: atest FrameworksNetTests
Change-Id: I85363e28b46b89ae60a85219313c2a45bd5e7dd5
2021-02-04 20:12:40 -08:00
James Mattis
fb7e0c322d Merge changes Ic41fdc40,I5851a36e am: 34989a9c9e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1566351

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id949051a7aa834be339530f5db6cdd36ec2ea7f2
2021-02-05 03:49:50 +00:00
Chiachang Wang
21fbe81e4c Create new system API in UserHandle to get uid
For the incoming connectivity mainline, it need to compute the
intersection of a set of uids and appIds for the permission
control. As @UserIdInt values are internal implementation details
of the OS, any mainline modules should use strongly-typed
UserHandle arguments. Thus, create a new API that accepts
UserHandle and appId to get the computed uid.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: I046546d2c5c76eac7a251e63e4234776975bf2bc
2021-02-05 02:26:23 +00:00