Commit Graph

1552 Commits

Author SHA1 Message Date
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
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
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
Lorenzo Colitti
87ce7654bf Merge changes Ieb7f33bc,I81b56862 am: df7233f8e1 am: 92860eb233 am: 90cf1ed3f7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1570920

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie296e709b883fc2930b83dffbfb1366dd4a7e7e7
2021-02-05 09:55:17 +00:00
Paul Hu
0b756aeb45 Merge "Replace NPMI#isUidNetworkingBlocked()" am: 9113cf2872 am: c48b6bb362 am: b3cd3bb875
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536313

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I53f5fb0996ad08c8a44c0560ab72725c47e39215
2021-02-05 08:15:29 +00:00
Lorenzo Colitti
df7233f8e1 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
Paul Hu
9113cf2872 Merge "Replace NPMI#isUidNetworkingBlocked()" 2021-02-05 06:38:02 +00:00
Lorenzo Colitti
f5a4ac9592 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
3a2a0a31f4 Make testLegacyLockdownVpn more realistic.
Bug: 173331190
Test: test-only change
Change-Id: I81b5686244f479d967c826e29eba4feb396a09cf
2021-02-05 14:36:54 +09:00
paulhu
97114c99b4 Replace NPMI#isUidNetworkingBlocked()
ConnectivityService is going to become a mainline module which
will not able to access hidden APIs. NetworkPolicyManagerInternal
is a internal serivce that CS can't be access after be a mainline
module. Thus, create NPM#checkUidNetworkingBlocked to replace it.

Bug: 170598012
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Test: atest CtsHostsideNetworkTests
Test: atest FrameworksCoreTests:NetworkPolicyManagerTest
Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest
Change-Id: I7bee37522dc5c55c255b159fda9481eff663655a
2021-02-04 19:28:57 +08:00
Aaron Huang
a8a74f1988 Update VpnTest for new restricted API
This patch addressses the mocked UserManager for the context
of the user which is created by createContextAsUser.

Bug: 171529940
Bug: 175883995
Test: FrameworksNetTests
Change-Id: Ie72d08c765ed7fb7083c0c4b7ee02a43c23d1707
2021-02-04 19:14:57 +08:00
Treehugger Robot
a9c77e909e Merge "Revert the fallback naming into default network" am: 068b629dfe am: 74126b9bb0 am: 4e42931c64
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1574083

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I697cbceff12a2cdc2aa7c36bcfbf4ea28f68ab82
2021-02-04 10:12:01 +00:00
Lorenzo Colitti
02e6ba7210 Merge "Improve getConnectionOwnerUid tests." am: bd2f639a30 am: aa7644c9f9 am: 42f099f5c2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1572980

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie69cc409c24468aaebb4a0267009bdc4f9b7a622
2021-02-04 10:11:21 +00:00
junyulai
1243a00669 [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
Treehugger Robot
068b629dfe Merge "Revert the fallback naming into default network" 2021-02-04 08:48:21 +00:00
Lorenzo Colitti
dbcd5d632a Improve getConnectionOwnerUid tests.
Currently, the tests only check whether the method throws a
SecurityException or not. Also check the return value of the
call, by mocking out InetDiagMessage.getConnectionOwnerUid.

This is required to test an upcoming change that will never
throw SecurityException but always return INVALID_UID if the
caller lacks permissions.

Bug: 173331190
Test: test-only change
Change-Id: I63f42a2f098fcf8796c9b4525a3a7b8320c0a139
2021-02-04 04:19:28 +00:00
Chalard Jean
1bc77a99e3 Revert the fallback naming into default network
There is strong opposition in the team to this rename.
Reverting to the old language.

Test: FrameworksNetTests
Change-Id: Icefa3090966c07fd66692ddd5b44dfc94485a914
2021-02-04 13:14:05 +09:00
Lorenzo Colitti
b1014ac0e4 Merge changes Ifa2aa335,I09366a7f am: 7fed667205 am: 1700ac64d3 am: 61074fe878
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1565201

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2ac2a510eb5837acd77b2d7884da0af14cca502f
2021-02-03 16:33:10 +00:00
Chalard Jean
a02d3f4256 Merge "[NS] Tests : don't expect a score in NF#acceptRequest" am: c6bf15898a am: 8b1998bfb2 am: 66ab10ca12
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556098

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie9e2883453e20f09a269b99ccf8e3ec86b66964b
2021-02-03 10:25:02 +00:00
Lorenzo Colitti
94d03aecfc Allow passing the underlying network to startLegacyVpn.
This will be used by a future change that makes the legacy
lockdown VPN pass the underlying network.

Bug: 173331190
Test: tests in subsequent CLs in stack
Change-Id: I09366a7f872ef3d4538962a75b0114a2ecb536e6
2021-02-03 19:03:53 +09:00
Chalard Jean
c6bf15898a Merge "[NS] Tests : don't expect a score in NF#acceptRequest" 2021-02-03 08:10:19 +00:00
James Mattis
959f869760 Merge "Adding support for multiple "default" networks" am: ca0ab687be am: 24bc30f408 am: b68cb3106c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1532548

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibcb06ea4004e988190ac8ae0dfaa2498d79777fb
2021-02-03 06:44:30 +00:00
James Mattis
8af2d60519 Adding support for multiple "default" networks
Updating ConnectivityService foundational support for multiple default
networks by extending mDefaultRequest and mDefaultNetworkNai from single
instances to a HashMap to support more than a single default network.

Bug: 176027457
Bug: 172347841
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I2f5fa96c2d21ab883499e82afa74e73f3ca606cd
2021-02-02 16:14:36 -08:00
Lorenzo Colitti
89ef449561 Merge changes I4f38a539,Id4f6c7f4 am: 7b49264237 am: 6964d11672 am: 79f031dadc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1565198

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I49cd86725c481827b4278e05afd4847c3a06e8d7
2021-02-02 11:49:08 +00:00
Lorenzo Colitti
786947b4ac Improve testing for network blocking.
This simplifies the uidNetworkingBlocked method and makes it more
realistic by supporting more combinations of rules than just the
four used by this test.

Also support RULE_ALLOW_METERED, and add test coverage for it.

Test: test-only change
Change-Id: Id4f6c7f41429f3ae7841d3214b3e5e95ec591f85
2021-02-02 16:17:22 +09:00
Chalard Jean
efb8409f66 [NS] Tests : don't expect a score in NF#acceptRequest
The score argument is going away, so there no longer
is a need to test it. It's never been used by anybody
and is actually a problem going forward.

Since removing the argument requires a small re-arch
of the testing tool anyway, rebuild expecting requests
on top of TrackRecord. This simplifies the test a
great deal, as well as (as observed in running the
tests) makes the test faster.

Test: this
Change-Id: If03b9e64f14ac8ffa5398b964939a9a45a74b28d
2021-02-01 23:06:49 +09:00
Lorenzo Colitti
ec960a86ce Merge changes Idcc9e32c,I58769bb7 am: e73a36ba21 am: 203c72f86c am: 910fb03907
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552503

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3d15c00910467d51531a25c025efb491b446b6a4
2021-02-01 12:41:24 +00:00
Lorenzo Colitti
e73a36ba21 Merge changes Idcc9e32c,I58769bb7
* changes:
  Remove getFilteredNetworkState and add @NonNull in NetworkState.
  Add test coverage for get*NetworkInfo on metered networks.
2021-02-01 10:56:19 +00:00
Lorenzo Colitti
0e920055dc Add test coverage for get*NetworkInfo on metered networks.
Test: test-only change
Change-Id: I58769bb768978d0acff1da6d32c2f6942c43508b
2021-02-01 15:58:12 +09:00
Junyu Lai
680e2d4f64 Merge "[FUI04] Refactor VpnInfo" am: 149add890e am: ba245e077f am: 55c1a77fea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1537211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icfa9918e41fc3f952a23956108df4db449741364
2021-01-29 23:38:06 +00:00
Junyu Lai
3c48d0cf6f Merge "[VCN06] Support request background network" am: 2141aec60a am: 336c5d93a7 am: 4d9ef0fc1e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1553866

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I50867bc7cb21eb134f20af9ef55c44c2bd8962e9
2021-01-29 23:36:41 +00:00
Junyu Lai
149add890e Merge "[FUI04] Refactor VpnInfo" 2021-01-29 13:54:53 +00:00
Junyu Lai
2141aec60a Merge "[VCN06] Support request background network" 2021-01-29 11:02:02 +00:00
junyulai
62d35f7e59 [FUI04] Refactor VpnInfo
As a preparation of exposing system API. This patch does some
harmless refactoring, which includes:
  1. Change raw arrays into lists according to API guidelines.
  2. Write test.
  3. Rename class to UnderlyingNetworkInfo.
  4. Rename vpnIface to iface.
  5. Make underlyingIfaces @NonNull in order to adapt new
     unparceling code.
  6. implement equals and hashCode for testing.

Test: atest android.net.UnderlyingNetworkInfoTest
Bug: 174123988

Change-Id: I405c21e57c4af8a12a9dd0a1749b9e6690f87045
2021-01-29 17:44:32 +08:00
Junyu Lai
23568a4f04 [VCN06] Support request background network
This will be mainly used by VCN management service which will
need to hold the networks but preserve the backgrounded-ness
of the networks.

Test: android.net.ConnectivityManagerTest#testRequestType
Test: android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork /
      --rerun-until-failure 100
Test: ConnectivityServiceTest#testBackgroundNetworks
Test: m -j doc-comment-check-docs
Bug: 175662146

Change-Id: I463c7a3139a286e50ea71e674060975ce228caa9
2021-01-29 14:42:32 +08:00
Junyu Lai
8d06e8aba8 Merge "[VCN01] Add NOT_VCN_MANAGED capability" am: 00caf89795 am: 227fc5d23d am: f76c711734
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1549897

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ide501fcf659637c0ec175d3f6f5926c2482734e0
2021-01-28 14:58:38 +00:00
Junyu Lai
00caf89795 Merge "[VCN01] Add NOT_VCN_MANAGED capability" 2021-01-28 13:04:59 +00:00