Commit Graph

6590 Commits

Author SHA1 Message Date
Chiachang Wang
7b0f3d0f11 Merge changes from topic "AppExclusion" am: 7b6fa7c457 am: 3350cb96a3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2076559

Change-Id: Ic5cb43ee4e4c32c2372b78605403ba57afb89b0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-05 02:20:22 +00:00
Chiachang
d19b3c03d2 Allow getting/setting app exclusion list for specific vpn profile
Provide a way for the system Setting app or other similar system
apps to set the app exclusion list for the specific VPN from
VpnManager. The list affects only VPN provisioned from
VpnManager to keep the design consistence for app using
VpnService.

The list is stored in the keystore for its persistence.

Bug: 192078259
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I157823866e1899b40aa36ea2c0bc4a80370108be
2022-05-04 02:20:54 +00:00
TreeHugger Robot
bb6fcc10f1 Merge "Uri: check authority and scheme as part of determining URI path" into tm-dev am: 2186274898
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17955879

Change-Id: Ie8bb3ed0f3de2aadb19f7a119aee9e387ca013f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-28 09:15:29 +00:00
Lucas Lin
23e7c017a6 Merge changes I4bfaf79a,I8711187e am: 0a4fd7e9ea am: d592422bc7
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2073067

Change-Id: Idbfe4fddbb59658f8930f4a8d67334dc22a298ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 17:54:25 +00:00
Orion Hodson
e082ece64f Uri: check authority and scheme as part of determining URI path
The interpretation of the path depends on whether the scheme or
authority are specified and should be observed when unparcelling
URIs.

Bug: 171966843
Test: atest FrameworksCoreTests:android.net.UriTest
Test: atest com.android.devicehealthchecks.SystemAppCheck
Change-Id: I06981d1c6e387b16df792494523994518848db37
Merged-In: I06981d1c6e387b16df792494523994518848db37
(cherry picked from commit f37a94ae92)
2022-04-26 17:57:27 +00:00
lucaslin
c867675e38 Add equals() & hashCode() for VpnProfileState
Bug: 225010642
Test: atest FrameworksNetTests:VpnTest
Change-Id: I8711187e690385866fa681c3fe5fccdf353ac30b
2022-04-25 16:14:58 +08:00
Lucas Lin
5f0eff2a06 Merge changes I7fd4b6da,Ia36d7944,If7eb7e0e am: 54a348cf84 am: 990e43f4cc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2065434

Change-Id: I1c6ecb3e0b63e2d207357c106dfaf5420f237f26
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-22 10:59:32 +00:00
lucaslin
4b6b7987a1 Modify javadoc for some extra values of VpnManager event
The underlying network, NetworkCapabilities and LinkProperties
are not necessary to send to VPN app since the purpose of
CATEGORY_EVENT_DEACTIVATED_BY_USER and
CATEGORY_EVENT_ALWAYS_ON_STATE_CHANGED are to notify VPN
app that VPN is deactivated by the user or VPN always-on
status is changed.

Bug: 191413541
Test: Javadoc only changes.
Change-Id: I7fd4b6dad1a4363336f03c217e635fc45bcd0ab6
2022-04-22 09:28:28 +08:00
lucaslin
6a75e5a3c5 Add toString() for VpnProfileState
Sample log:
{State: DISCONNECTED, SessionId: null, Always-on: false,
Lockdown: false}
{State: CONNECTED, SessionId: d7913298-c07f-49de-b84e-304b5e26da89,
Always-on: true, Lockdown: false}

Bug: 225010642
Test: Add a log in Vpn.java and print it.
Change-Id: Ia36d794446114c0c2c27e725cba6a4dc1240ae38
2022-04-22 09:28:21 +08:00
Benedict Wong
83e6ae270a Merge "Add CarrierConfig to TelephonySubscriptionSnapshot" am: 59aeaf29c0 am: d868725c8c am: 1670176e65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2063410

Change-Id: I83b7473cc8358213b5ce87781cb534d9ebf79991
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-21 18:27:16 +00:00
Benedict Wong
59aeaf29c0 Merge "Add CarrierConfig to TelephonySubscriptionSnapshot" 2022-04-21 17:40:58 +00:00
Benedict Wong
52629838cb Add CarrierConfig to TelephonySubscriptionSnapshot
This change ensures that carrier configs are saved as part of the
snapshot, allowing all entities in the VCN to query telephony
subscription information from the same source.

Test: atest FrameworksVcnTests
Change-Id: I31447d84fe98d6bd2cc78ead41746198728c400b
2022-04-21 01:09:36 +00:00
Junyu Lai
7fa2bca312 Merge "Fix NetworkTemplate generates non-metered carrier template" am: 70c3d35319 am: 5301fd1488 am: 1361b459c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2065438

Change-Id: Ieabb4c07554b129308bdbeddf92376193df36870
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 06:08:15 +00:00
Junyu Lai
14ac19c709 Fix NetworkTemplate generates non-metered carrier template
From current design, NetworkPolicyManagerService should only
creates metered carrier/mobile templates. However, if someone
calls the hidden API interface or the template was created
before NetworkTemplate#Builder is published. The caller may
create a non-metered carrier template and persist into the
storage.

This CL elimates this possibility and mark non-metered carrier
template non-persistable, so devices could auto-recover from
this symptom after reboot.

Fix: 222382637
Test: TH
Change-Id: Ia7ba3d92a84b8b246a4f11080f6fec0957865650
2022-04-18 16:54:27 +08:00
Sudheer Shanka
efa4f74236 Ignore older UID state change callbacks in NPMS.
Since the onUidStateChanged() callbacks will be
happening from more than one thread, we need to make
sure we only handle the latest uid state change
callbacks and ignore any older callbacks that could
override the latest uid states in NPMS. In order to
this, every uid state change will be associated with
a unique seq number.

Also, remove the UidRecord.lastDispatchedProcStateSeq.
This was added as a safety measure to make sure we
don't unnecessarily end up waiting but it isn't
necessary and if we need to keep it, we need to add
a way to access it without holding global AMS lock,
which isn't worth the complexity.

Bug: 226299593
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I631f5e01f6627916a96c930c22849a1d11eab636
Merged-In: I631f5e01f6627916a96c930c22849a1d11eab636
2022-04-15 09:39:49 +00:00
Benedict Wong
0ae3528dc7 Merge "Allow provisioning package to retrieve subGrp, clear it's own config" am: 1428215bee am: 6b6f825b26 am: 4a6b279bb5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2056512

Change-Id: Ic537ef95af0424aef9f980cd124adac3dde1294a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-14 19:48:12 +00:00
Benedict Wong
1428215bee Merge "Allow provisioning package to retrieve subGrp, clear it's own config" 2022-04-14 17:52:15 +00:00
Benedict Wong
1a8f3e0a14 Allow provisioning package to retrieve subGrp, clear it's own config
This changes the VCN to allow a VCN provisioning package to retrieve
its listing of configured subgroups and clear its own configurations,
regardless of whether it is the active subscription group.

Safety is guaranteed based on the VCN's clearing of packages when app
data is cleared, and when the app is uninstalled. In addition to the
configurations not being retrievable, the clearing of the configs will
ensure that sideloading of an app with the same package name provides
no ability to otherwise impact settings.

Bug: 227248744
Test: atest FrameworksVcnTests
Change-Id: I2c774c00373942f895169a761d4e9a1d5b0b2edb
2022-04-13 22:10:21 +00:00
Treehugger Robot
0ec82bc2b1 Merge "Add extra logging" am: 47b98a2d38 am: 9479208dd3 am: 09d3410e51
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2056510

Change-Id: Ia004c32a217f5ec0abd695b0ec6c9f2fbf82d211
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-13 10:05:52 +00:00
Treehugger Robot
47b98a2d38 Merge "Add extra logging" 2022-04-13 08:16:28 +00:00
Robert Horvath
7881ffd09f Merge "Add Low Power Standby support to NetworkPolicyManagerService" 2022-04-11 08:48:34 +00:00
Chiachang Wang
dd859dc564 Merge "Update the java doc" am: b7e998e235 am: a076a5ee40 am: 9df60ac18b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2057431

Change-Id: Icf377a4cdf7ee2246286a7eb02e41040d397ea57
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 04:01:46 +00:00
Chiachang Wang
b7e998e235 Merge "Update the java doc" 2022-04-11 02:54:46 +00:00
Sudheer Shanka
b57c865855 Ignore older UID state change callbacks in NPMS.
Since the onUidStateChanged() callbacks will be
happening from more than one thread, we need to make
sure we only handle the latest uid state change
callbacks and ignore any older callbacks that could
override the latest uid states in NPMS. In order to
this, every uid state change will be associated with
a unique seq number.

Also, remove the UidRecord.lastDispatchedProcStateSeq.
This was added as a safety measure to make sure we
don't unnecessarily end up waiting but it isn't
necessary and if we need to keep it, we need to add
a way to access it without holding global AMS lock,
which isn't worth the complexity.

Bug: 226299593
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I631f5e01f6627916a96c930c22849a1d11eab636
2022-04-08 13:45:54 -07:00
Benedict Wong
421e051e8a Add extra logging
This adds additional logs to the VCN's dumpsys to facilitate debugging
of the VCN.

Test: atest FrameworksVcnTests
Change-Id: Id8cd668991331dbf2f3395172e5cd90b36c408a9
2022-04-08 18:06:38 +00:00
Robert Horvath
56317f3ccf Add Low Power Standby support to NetworkPolicyManagerService
Bug: 190822356
Test: atest NetworkPolicyManagerServiceTest
Merged-In: I6c554df71b12bcf06f1c98ef70c35242bc90a689
Change-Id: I4b3f2625e9eed296055813e4641da9f85f8c7929
2022-04-08 14:50:42 +00:00
Chiachang Wang
4319575deb Merge "Ignore other IKE options if IkeTunnelConnectionParams is set" am: 48160f9b9b am: 3caa3cf399 am: 2194a62f15
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1978249

Change-Id: I494bcbae0a8ba83d8950db060c8f0fb3447ed050
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 11:37:31 +00:00
Chiachang Wang
240d126ed0 Update the java doc
Bug: 184750836
Test: m
Change-Id: If7a64d0a7d607dafa353c3dfd4bcbac189d1fef3
2022-04-07 18:32:09 +08:00
Chiachang Wang
48160f9b9b Merge "Ignore other IKE options if IkeTunnelConnectionParams is set" 2022-04-07 10:24:03 +00:00
Neil Fuller
0c3ae4d50e Merge "Switch core network tests from postsubmit to presubmit" am: 339c76a9ed am: 6f6e94088c am: 49ec042540
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1892638

Change-Id: Icf63a1761d9443fb49238c0b25c597735fb131d8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-06 13:49:37 +00:00
Neil Fuller
339c76a9ed Merge "Switch core network tests from postsubmit to presubmit" 2022-04-06 12:25:06 +00:00
Chiachang Wang
3cb07d737d Ignore other IKE options if IkeTunnelConnectionParams is set
Stop parsing the IKE options from the input IkeTunnelConnectionParams
if exists. The caller shuould get the relevant infortation the
params.

The field is also stored in the VpnProfile if it built from an
Ikev2VpnProfile.

Bug: 184750836
Test: atest FrameworksNetTests HostsideVpnTests
Test: build ; flash ; connect VPN successfully
Change-Id: Id05c17285915462c7a6cd51d5fb4ee5da7f465ba
2022-04-06 17:25:58 +08:00
Sarah Chin
0bf5d39174 Merge "Ensure SubscriptionPlans can be removed" 2022-03-21 15:55:45 +00:00
Lorenzo Colitti
4aaa394f28 Merge "Store IkeTunnelConnectionParams in Ikev2VpnProfile" am: bc6f905d38 am: 492871c0b1 am: 4d46a14600
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2029924

Change-Id: Iacea8798dd865bd7900a96784a028184c41dbb89
2022-03-19 06:28:36 +00:00
Lorenzo Colitti
bc6f905d38 Merge "Store IkeTunnelConnectionParams in Ikev2VpnProfile" 2022-03-19 05:34:30 +00:00
Benedict Wong
7c3eacb6a7 Merge changes I67470903,Ia80da6d4,I332397f4 am: 7d042ad402 am: f1dacac9ea am: 639c60d696
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2030266

Change-Id: Ic90ee169932a8c5db483dea4df64c9cf0129f9a4
2022-03-18 22:32:02 +00:00
Sarah Chin
1ef011e510 Ensure SubscriptionPlans can be removed
Add a duration that the plans last and don't read to/write from disk
for plans. Make non-duration setSubscriptionPlans API deprecated.

Test: atest SubscriptionManagerTest, NetworkPolicyManagerServiceTest
Bug: 210696427
Change-Id: I93aece78eda324c333fbf9f1adbedcf46e4864f0
Merged-In: I93aece78eda324c333fbf9f1adbedcf46e4864f0
2022-03-18 15:27:57 -07:00
Benedict Wong
7d042ad402 Merge changes I67470903,Ia80da6d4,I332397f4
* changes:
  Define and implement getProvisionedVpnProfileState()
  Introduce VpnProfileState
  Define new constants of ACTION_VPN_MANAGER_EVENT
2022-03-18 21:47:47 +00:00
Sarah Chin
f3ecc6182b Merge "Update getSubscriptionPlans documentation" 2022-03-18 21:22:49 +00:00
Sarah Chin
5fe695fbdd Update getSubscriptionPlans documentation
getSubscriptionPlans can return null if a plan has not been set for the
given subId yet. Change the annotation from @NonNull -> @Nullable and
update the documentation. SubscriptionManager#getSubscriptionPlans will
return the @NonNull plans instead.

Test: build
Bug: 213896944
Change-Id: I7b232a1a695d1db7cb0d0a177bb1090e9033b805
Merged-In: I7b232a1a695d1db7cb0d0a177bb1090e9033b805
2022-03-18 09:58:47 -07:00
Neil Fuller
ad7b8429d0 Merge "Add the ability to configure NTP port for tests" am: 72e04a7dc2 am: 53d21a8591 am: 0fa758c3b8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2030083

Change-Id: Ib22fde6cf8bfba028d286647b10b1d2885d78c9d
2022-03-18 12:49:40 +00:00
Neil Fuller
72e04a7dc2 Merge "Add the ability to configure NTP port for tests" 2022-03-18 11:48:29 +00:00
lucaslin
0ae29f0cd5 Define and implement getProvisionedVpnProfileState()
CTS-Coverage-Bug: 225010642
Bug: 225010642
Test: CtsNetTestCases:Ikev2VpnTest
Change-Id: I67470903bba2f783e316be47a50c438e049ca856
2022-03-18 11:24:12 +00:00
lucaslin
f306a53e48 Introduce VpnProfileState
This class can provide the state of VPN, session key and the
settings of always-on and lockdown.

CTS-Coverage-Bug: 225010642
Bug: 225010642
Test: N/A
Change-Id: Ia80da6d4c165680f8c8c7cba0aa4246a5c5934da
2022-03-18 11:24:01 +00:00
lucaslin
836a3e3d83 Define new constants of ACTION_VPN_MANAGER_EVENT
CTS-Coverage-Bug: 225010642
Bug: 225010642
Test: N/A
Change-Id: I332397f4f65596740670d96c72c85ad216d2a1bc
2022-03-18 08:08:35 +00:00
Chiachang Wang
41e5cc7039 Store IkeTunnelConnectionParams in Ikev2VpnProfile
IkeTunnelConnectionParams contains more information than the
existing fields inside Ikev2VpnProfile. If the Ikev2VpnProfile
is built from an IkeTunnelConnectionParams, saving it to the
existing fields of Ikev2VpnProfile may cause information lost,
such as IKE options. Thus, store the IkeTunnelConnectionParams
as a field inside Ikev2VpnProfile.

The other Ike options are mutually exclusive with
IkeTunnelConnectionParams. The information such as Preshared
key or username/password may not return expected values if a
profile is built from an IkeTunnelConnectionParams. This may
confuse API callers for using the other getters. Thus, expose
a getter to retrieve IkeTunnelConnectionParams

Bug: 184750836
Test: atest FrameworksNetTests
CTS-Coverage-Bug: 184750836
Change-Id: I61e9a9549b87951956afdcbae2518228994e4729
2022-03-18 10:45:47 +08:00
Neil Fuller
187c975af9 Add the ability to configure NTP port for tests
Add the ability to configure NTP port for tests via the command line and
the associated plumbing / knock-ons.

In-progress CTS tests will run a fake NTP server on the device itself.
Binding to NTP's default port of 123 is restricted. Therefore, we need
to be able to override the port for tests.

adb shell cmd network_time_update_service set_server_config --port 9999
adb shell dumpsys network_time_update_service
<observe port value>
adb shell cmd network_time_update_service force_refresh
<observe false>

adb shell cmd network_time_update_service set_server_config
adb shell dumpsys network_time_update_service
<observe port value>
adb shell cmd network_time_update_service force_refresh
<observe true>

Bug: 213393821
Test: See above
Change-Id: I21e8b735fab268df0d617848b8a562f86560ad16
2022-03-17 11:36:19 +00:00
Frank Li
682c05e0f0 Merge "[DU04-2]Appropriate changes to the NetworkPolicyManager API" am: c48d90e91b am: acb77010ac am: 858f0d75e4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2007132

Change-Id: I7e5dc71e1705a7c205c0fd6a7cb57e75cae5a4fc
2022-03-16 13:20:10 +00:00
Frank Li
c48d90e91b Merge "[DU04-2]Appropriate changes to the NetworkPolicyManager API" 2022-03-16 12:28:24 +00:00
Frank
7c43d8fcac [DU04-2]Appropriate changes to the NetworkPolicyManager API
Divide the NetworkPolicyManager API
notifyStatsProviderWarningOrLimitReached into the following two APIs:
1. notifyStatsProviderWarningReached()
2. notifyStatsProviderLimitReached()

Bug: 216474563
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest OffloadControllerTest
Change-Id: Ic413eb532b5e24d4a7e2afabdcf643ab6607b1ed
2022-03-16 14:23:50 +08:00