Commit Graph

6613 Commits

Author SHA1 Message Date
Hai Zhang
b90e6818c3 Extract four byte sequence modified UTF-8 into separate classes.
The four byte sequence modified UTF-8 is now handled by classes
prefixed with ART, whereas the base classes implements the standard
modified UTF-8 and should be used by new clients in modules.

Bug: 243194720
Test: atest -rerun-until-failure 10 FastDataTest BinaryXmlTest \
      FrameworksCoreTests:XmlTest FastDataPerfTest
Change-Id: I08cea54c2a27249e00b7e155af0cf11949486375
2022-10-21 04:28:10 -07:00
Lorenzo Colitti
74b3866a3f Merge "Skip duplicate parameters when IkeTunnelConnectionParams provided" am: 5fbb561060 am: 1fb227f17f am: 788c6cc563 am: 7e87ea0629 am: 5999bc26a9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2200482

Change-Id: I8a9a3c0a4de4c0aeccdedc02ae9d156114786c08
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-20 16:12:53 +00:00
chiachangwang
84afc69b95 Skip duplicate parameters when IkeTunnelConnectionParams provided
For those fields existing in the IkeTunnelConnectionParams,
the value should be retrieved from the object to honor the
setting in the object. IkeTunnelConnectionParams are serialized
in a safe manner to ensure that they do not conflict with the
serialization scheme of VpnProfile. However, copying some of
these fields(e.g. IkeKeyId) may conflict with the serialization
scheme.

Bug: 243718982
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I510c47e26feabd5cebe9497ef495e4d729d0f7c6
2022-09-14 05:09:52 +00:00
Chiachang Wang
6fa31bcb7d Merge "Correctly handle null ProxyInfo in Ikev2VpnProfile" am: a03fa63d19 am: a50c41b050 am: fea2f221ed am: fc24e0777b am: 275cf344e1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2200896

Change-Id: Ia770cb4679e5c99ced788ed7e2003e5ba46d31be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 14:52:47 +00:00
chiachangwang
29348dbfca Correctly handle null ProxyInfo in Ikev2VpnProfile
This change ensures that null ProxyInfo instances are honored
and reflected in the actual VpnProfile.

Ikev2VpnProfiles incorrectly set ProxyInfo as an empty instance
when provided with a null ProxyInfo. Other components in the
system sometimes have different behavior if presented with an
empty ProxyInfo instead of a null one.

Bug: 244281603
Test: atest FrameworksNetTests
Test: Manual testing with VPN validation enabled
Change-Id: I67ee2aa5c96dc22ba8fcd2be3fd4c090dec20697
2022-09-02 02:51:33 +00:00
Yan Yan
7099653c3a Merge "Add three new IKE options in IkeSessionParamsUtils" am: dd4f288e31 am: e6a6d58fa2 am: 75cf48c8f0 am: 895b372f77 am: ab01d9630c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2191196

Change-Id: I1910e55f099f557d85ba916c220e6922c42bc9d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-22 20:31:17 +00:00
Yan Yan
332f738998 Add three new IKE options in IkeSessionParamsUtils
This commit updates IkeSessionParamsUtils to be able
to encode/decode IkeSessionParams with IKE_OPTION_REKEY_MOBILITY,
IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION and
IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES.

This commit can also maintain compatibility with older T IPsec
modules that do not support the two IKE_OPTION_AUTOMATIC_ options

Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: Icadbe98b3df3cf3a80f51dc1467eb99753d82216
2022-08-19 23:52:54 +00:00
Yan Yan
cd8a02482b Merge "Revert "Add three new IKE options in IkeSessionParamsUtils"" am: c271a2da6a am: 9c20b1ede6 am: 92ac8f2ac9 am: 3f7609bf0c am: 6817cb01ac
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2190278

Change-Id: I1abbd539f93ac41d8cb37ddca44e551246a187db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-19 23:30:57 +00:00
Yan Yan
006ba183f6 Revert "Add three new IKE options in IkeSessionParamsUtils"
This reverts commit de1dca7c76.

Reason for revert: This commit will be cherry picked for QPR
release and is accessing new IPsec API constants
that will not be released until mainline October train. This
commit fails to maintain the compatibility with IPsec
module that is older than the October version.
Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: Iff0dcc32025dad3016257655205beaf2e842f24c
2022-08-19 19:08:49 +00:00
Treehugger Robot
f3c3e06b58 Merge "Add three new IKE options in IkeSessionParamsUtils" am: 15f9600eb6 am: bcd10cbef5 am: 05846e1c82 am: aea063dbec am: ba77e19b54
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2185043

Change-Id: I1ee6d8337e17967102f33b169a1b5946061bb5ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-19 17:07:25 +00:00
Treehugger Robot
15f9600eb6 Merge "Add three new IKE options in IkeSessionParamsUtils" 2022-08-19 02:49:04 +00:00
Yan Yan
de1dca7c76 Add three new IKE options in IkeSessionParamsUtils
This commit updates IkeSessionParamsUtils to be able
to encode/decode IkeSessionParams with IKE_OPTION_REKEY_MOBILITY,
IKE_OPTION_AUTOMATIC_ADDRESS_FAMILY_SELECTION and
IKE_OPTION_AUTOMATIC_NATT_KEEPALIVES

Bug: 242231517
Test: atest IkeSessionParamsUtilsTest
Change-Id: I0ea9fbf1e0c304a5afb563f912d2a8a49b4faad0
2022-08-17 20:37:16 +00:00
TreeHugger Robot
326fa474f9 Merge "Further refactoring for multiple NTP servers" 2022-07-14 11:37:31 +00:00
Neil Fuller
d3d6a4d154 Further refactoring for multiple NTP servers
Further refactoring to support adding multiple NTP servers in a later
commit. The logic for multiple servers will be added to forceRefresh()
later.

This commit also contains some refactoring to support improved testing
of NtpTrustedTime.forceRefresh(). Tests for the existing behavior have
been added here.

As part of this change, SntpClient / NtpTrustedTime /
NetworkTimeUpdateService have also been extended to pipe information
about the IP address of the NTP server used to obtain the time back to
the NetworkTimeUpdateService for improved logging / debugging support.

Bug: 223365217
Test: atest frameworks/base/core/tests/coretests/src/android/util/NtpTrustedTimeTest.java
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/timedetector/
Test: atest cts/tests/tests/os/src/android/os/cts/SystemClockSntpTest.java
Test: Inspection: adb shell dumpsys network_time_update_service
Test: Inspection: adb shell dumpsys time_detector
Change-Id: Ia0f13e2c8cbd102d677797b745414d8ab5fa1eba
2022-07-14 09:43:03 +01:00
Hani Kazmi
4f221e5c51 Migrate Bundle/Intent APIs to new, type checked, variants
Part of go/safer-parcel. Follow up to ag/16639043. Migrates the following unsafe APIs:

* Parcel.readArray()
* Parcel.readParcelableArray()
* Bundle.getSerializable()
* Bundle.getParcelable()
* Bundle.getParcelableArrayList()
* Bundle.getParcelableArray()
* Bundle.getSparseParcelableArray()
* Intent.getSerializableExtra()
* Intent.getParcelableExtra()
* Intent.getParcelableArrayExtra()
* Intent.getParcelableArrayListExtra

Bug: 227458983
Test: m and presubmit pass
Change-Id: I72f206cb18eb5c669a7fff07a6845bed1c433fdb
2022-07-01 10:53:53 +00:00
Benedict Wong
24b65ea22a Merge "Add VPN app into power saver whitelist for a while to start its service" am: df656e6141 am: 1457cc5d4d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2114435

Change-Id: I6c693ce6f537183db45cb73fb0ac690914ac1c30
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-03 06:16:47 +00:00
lucaslin
62991fc4ad Add VPN app into power saver whitelist for a while to start its service
If the VPN app is not launched, then its background service
cannot receive the VpnManager events.
Add VPN app into power saver whitelist for a while can let its
background service to receive VpnManager events.

Bug: 234104087
Test: Confirm that the VPN app has received VpnManager events.
Change-Id: I9819a78ec0cbbd6879baae645ef42c22756b09d4
2022-06-02 06:25:53 +00:00
Junyu Lai
ad2be9ef85 Add null check when list directory
This change protect getPlatformFileListForPrefix from
crashing when the directory exist but cannot be listed.
This generally happens when the caller doesn't have
enough permission to list.

Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest#testDataMigrationUtils
Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Change-Id: I4177a8229cc9db18d76cb90c54a1b8d12ef8d98f
Merged-In: I4177a8229cc9db18d76cb90c54a1b8d12ef8d98f
  (pure cherry-picked from ag/18457684)
2022-05-24 10:31:09 +08:00
junyulai
807a7f37f0 [MS82.2] Add a rewriteSingle method that takes two timestamps
This CL provides a public method in FileRotator to
allow caller to write data to a specified standalone file.

This CL also fix a file name generatign error in platform
tools.

Test: NetworkStatsServiceTest NetworkStatsCollectionTest
Bug: 230289468
Change-Id: I17558f349cb2a33062972fe1af96a19356798692
Merged-In: I17558f349cb2a33062972fe1af96a19356798692
  (pure cherry-picked from ag/18408306)
2022-05-24 10:30:14 +08:00
Amith Yamasani
b6da699d30 Merge "Sanitize Uri.toSafeString() some more." into tm-dev 2022-05-19 16:53:29 +00:00
Junyu Lai
a9eceb80cc Add null check when list directory
This change protect getPlatformFileListForPrefix from
crashing when the directory exist but cannot be listed.
This generally happens when the caller doesn't have
enough permission to list.

Test: atest CtsNetTestCases:android.net.cts.NetworkStatsManagerTest#testDataMigrationUtils
Ignore-AOSP-First: in a topic with internal-only changes
Bug: 230289468
Change-Id: I4177a8229cc9db18d76cb90c54a1b8d12ef8d98f
2022-05-19 09:33:14 +08:00
junyulai
6ab8172b69 [MS82.2] Add a rewriteSingle method that takes two timestamps
This CL provides a public method in FileRotator to
allow caller to write data to a specified standalone file.

This CL also fix a file name generatign error in platform
tools.

Test: NetworkStatsServiceTest NetworkStatsCollectionTest
Bug: 230289468
Change-Id: I17558f349cb2a33062972fe1af96a19356798692
2022-05-17 16:08:27 +08:00
Amith Yamasani
3743e5586f Sanitize Uri.toSafeString() some more.
Bug: 190199986
Test: atest CtsNetTestCases:UriTest
Change-Id: I3689a70cb114099554372e93a0639294fd57bebb
2022-05-13 22:31:07 +00:00
Chiachang
7d1b14eb1f 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
(cherry picked from commit d19b3c03d2)
Merged-In: I157823866e1899b40aa36ea2c0bc4a80370108be
2022-05-13 10:32:31 +00:00
lucaslin
7e0ade67f7 Add equals() & hashCode() for VpnProfileState
Bug: 225010642
Test: atest FrameworksNetTests:VpnTest
Change-Id: I8711187e690385866fa681c3fe5fccdf353ac30b
(cherry picked from commit c867675e38)
Merged-In: I8711187e690385866fa681c3fe5fccdf353ac30b
2022-05-12 11:24:03 +00:00
lucaslin
bf3953a627 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
(cherry picked from commit 4b6b7987a1)
Merged-In: I7fd4b6dad1a4363336f03c217e635fc45bcd0ab6
2022-05-12 11:13:11 +00:00
lucaslin
0eb8f090f6 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
(cherry picked from commit 6a75e5a3c5)
Merged-In: Ia36d794446114c0c2c27e725cba6a4dc1240ae38
2022-05-12 11:12:40 +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
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
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