Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f589cf99 authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Automerger Merge Worker
Browse files

Merge "Read-only properties can have values of arbitrary length" am: 329f25d9

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2036307

Change-Id: I6aa4406c65fd185a9af8af032e3b149ba45e286c
parents 5aa2bac3 329f25d9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
        }