summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJerome Gaillard <jgaillard@google.com>2022-03-23 11:01:48 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-23 11:01:48 +0000
commitb2869273bb9406eb3417ffd06cb77ce542a2fccf (patch)
tree64a1b60cf5414bb4b80119faa32e486221f12624 /core/java
parenta7db7cb7126a4e1d8498a3579cb425d67a7f45ad (diff)
parentf589cf9955409523189827391cf964e63217f950 (diff)
Merge "Read-only properties can have values of arbitrary length" am: 329f25d91a am: f589cf9955
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2036307 Change-Id: I2f8c361b6a2b6a0b71fd937de9f36be7d62e7a79
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/SystemProperties.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index ab741990430f..82d4443ea724 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -218,14 +218,15 @@ public class SystemProperties {
/**
* Set the value for the given {@code key} to {@code val}.
*
- * @throws IllegalArgumentException if the {@code val} exceeds 91 characters
+ * @throws IllegalArgumentException for non read-only properties if the {@code val} exceeds
+ * 91 characters
* @throws RuntimeException if the property cannot be set, for example, if it was blocked by
* SELinux. libc will log the underlying reason.
* @hide
*/
@UnsupportedAppUsage
public static void set(@NonNull String key, @Nullable String val) {
- if (val != null && !val.startsWith("ro.") && val.length() > PROP_VALUE_MAX) {
+ if (val != null && !key.startsWith("ro.") && val.length() > PROP_VALUE_MAX) {
throw new IllegalArgumentException("value of system property '" + key
+ "' is longer than " + PROP_VALUE_MAX + " characters: " + val);
}