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

Commit eb55fb60 authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

Use log.wtf on debug devices if property cannot be set

This can be useful to detect problems in enabling experiments

Test: Manual
Bug: 73018322
Change-Id: Ide6d7f1476a1b775d449623a96a368cbb5f8d799
parent 42b5621e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.am;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.net.Uri;
import android.os.Build;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
@@ -98,9 +99,16 @@ class GlobalSettingsToPropertiesMapper {
        try {
            systemPropertiesSet(key, value);
        } catch (Exception e) {
            // Failure to set a property can be caused by SELinux denial. This usually indicates
            // that the property wasn't whitelisted in sepolicy.
            // No need to report it on all user devices, only on debug builds.
            if (Build.IS_DEBUGGABLE) {
                Slog.wtf(TAG, "Unable to set property " + key + " value '" + value + "'", e);
            } else {
                Slog.e(TAG, "Unable to set property " + key + " value '" + value + "'", e);
            }
        }
    }

    @VisibleForTesting
    protected String systemPropertiesGet(String key) {