Commit Graph

2488 Commits

Author SHA1 Message Date
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
James Mattis
c1af7f03e4 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
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
Jeongik Cha
0a3f173136 Merge "Specify version for aidl_interface explicitly" am: 7193b792e6 am: 3de6e9c81e am: 68d7f63719
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1569000

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iad0b9a4fecbf0082a839a7b47fc036acc8a04f9e
2021-02-03 04:28:30 +00:00
James Mattis
ca0ab687be Merge "Adding support for multiple "default" networks" 2021-02-03 04:17:47 +00:00
Jeongik Cha
7193b792e6 Merge "Specify version for aidl_interface explicitly" 2021-02-03 02:21:26 +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
Treehugger Robot
633444ee84 Merge "Update frameworks to use unbundled version of BouncyCastle." am: 9671b7eca8 am: f477bba3c4 am: ec9bb8cd13
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1559779

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iaf00137fbdfc3dacd99537f9f4e2da0ffbc9a844
2021-02-02 15:59:03 +00:00
Treehugger Robot
9671b7eca8 Merge "Update frameworks to use unbundled version of BouncyCastle." 2021-02-02 14:37:05 +00: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
Jeongik Cha
cdd223033d Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: I4c909903521cd8a766dca5312edd98d17b9e1308
2021-02-02 10:11:31 +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
Lorenzo Colitti
29e36cb8c8 Merge "Fix legacy APIs when VPN switches to suspended underlying network." am: 83563fd735 am: d892e45c9b am: edd29a2f23
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547497

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I21c1c7913987a2bb4d486e6ce8da24a76ddf2dc6
2021-01-28 08:06:46 +00:00
Daulet Zhanguzin
8ef2001b7f Update frameworks to use unbundled version of BouncyCastle.
Previously BouncyCastle methods were exposed as libcore APIs (@CorePlatformApi), which no longer possible when ART is updatable module (and can't guarantee BouncyCastle API stability)

Bug: 154796679
Test: Treehugger

Change-Id: I908681841a6766de88761767c77c4e2d4b5f56d5
2021-01-28 07:51:22 +00:00
Treehugger Robot
a7656b2d7e Merge "Note network interfaces based on transport" 2021-01-28 07:45:20 +00:00
Lorenzo Colitti
83563fd735 Merge "Fix legacy APIs when VPN switches to suspended underlying network." 2021-01-28 07:07:37 +00:00
Remi NGUYEN VAN
afd7560b29 Note network interfaces based on transport
Instead of classifying interfaces by network type in BatteryStats,
classify them based on the transports array provided by the
NetworkAgent.

Network types are deprecated and transports should be used instead. This
change allows BatteryStats to stop depending on unstable APIs such as
isNetworkTypeMobile.

This change also updates nullability annotations in ConnectivityService
and NetworkAgentInfo to show that the NetworkCapabilities are non-null
(as provided by the network agent) when calling
noteNetworkInterfaceTransports.

Bug: 174436414
Test: atest
  atest ConnectivityServiceTest#testBatteryStatsNetworkType \
      --rerun-until-failure 40

Merged-In: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8

Change-Id: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8
2021-01-28 15:10:54 +09:00
TreeHugger Robot
359e963945 Merge "Revert "Revert "Note network interfaces based on transport""" into sc-dev 2021-01-28 05:55:23 +00:00
Treehugger Robot
524489652e Merge "[FUI03] No-op refactoring of VpnInfo" am: c1140f2a33 am: 2b6868d243 am: 85c56d4826
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1547637

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I05e6b14fca44919610317831c147413b0a431224
2021-01-27 14:16:00 +00:00
Remi NGUYEN VAN
4768f6316e Revert "Revert "Note network interfaces based on transport""
Instead of classifying interfaces by network type in BatteryStats,
classify them based on the transports array provided by the
NetworkAgent.

Network types are deprecated and transports should be used instead. This
change allows BatteryStats to stop depending on unstable APIs such as
isNetworkTypeMobile.

This change also updates nullability annotations in ConnectivityService
and NetworkAgentInfo to show that the NetworkCapabilities are non-null
(as provided by the network agent) when calling
noteNetworkInterfaceTransports.

This is rolling forward a previously reverted change. The new change
also fixes MobileRadioPowerCalculatorTest that was broken when
submitting the previous change.

Bug: 174436414
Test: atest
      atest ConnectivityServiceTest#testBatteryStatsNetworkType \
          --rerun-until-failure 40

Merged-In: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8

Change-Id: I4e928fac8a57a9b1fc758a44af2a5719b8c871b8
(cherry picked from commit 2d17d202bc709c205506c03149d847f00f92d78d)
2021-01-27 09:02:22 +00:00
Junyu Lai
120e49e971 [VCN01] Add NOT_VCN_MANAGED capability
Add new capability to indicate whether a network is
managed by Virtual Carrier Network (VCN). This is needed
to identify networks between VCN managed network and
others. And this capability will be:
  1. mutable
  2. requestable
  3. set by default for network agents and requests
  4. allowed for test networks

Note that this commit is identical to aosp/1529959 except the
capability remains hidden to address the javadoc problem first.
And this CL also needs to be bound with the counter part change
to prevent build breakage.

Test: 1. atest FrameworksNetTests CtsNetTestCases
      2. adb shell dumpsys connectivity
      3. atest ConnectivityServiceTest#testLoseMutableAndRequestableCaps
Bug: 175662146

Change-Id: I37a6f492c2aba72836e36851b50b67398f8bdd36
2021-01-27 16:13:01 +08:00
Paul Hu
79ad2808b9 Merge "Fix FrameworksNetIntegrationTests failure" am: 4071a8ccb1 am: 438f45fc13 am: b24091856f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1559105

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4a8b00c2f1b2d809e0aa3aa9f5a5cee58480fccd
2021-01-27 08:01:10 +00:00