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

Commit 0cd915aa authored by Ryan Zuklie's avatar Ryan Zuklie
Browse files

Catch errors thrown by SystemProperties.set

This can very rarely thrown an exception, particularly if this happens
around suspend/resume. It is not worth crashing system_server over, so
just log the exception instead.

Bug: 278996467
Bug: 278167962
Bug: 280269863
Test: atest FrameworksServicesTests:BatteryStatsHistoryTest
Change-Id: If597174f4c53f49542c1b442eba480bffaf80a59
parent 86e546f9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -253,7 +253,11 @@ public class BatteryStatsHistory {
        public void traceCounter(@NonNull String name, int value) {
            Trace.traceCounter(Trace.TRACE_TAG_POWER, name, value);
            if (mShouldSetProperty) {
                try {
                    SystemProperties.set("debug.tracing." + name, Integer.toString(value));
                } catch (RuntimeException e) {
                    Slog.e(TAG, "Failed to set debug.tracing." + name, e);
                }
            }
        }