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

Commit 4d8e9542 authored by Piotr Wilczyński's avatar Piotr Wilczyński Committed by Android (Google) Code Review
Browse files

Merge "Catch exception thrown by SystemProperties.set" into udc-qpr-dev

parents c888cf64 1637f137
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -2286,8 +2286,17 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            if (!reportOnly && mPowerState.getScreenState() != state
                    && readyToUpdateDisplayState()) {
                Trace.traceCounter(Trace.TRACE_TAG_POWER, "ScreenState", state);

                String propertyKey = "debug.tracing.screen_state";
                String propertyValue = String.valueOf(state);
                try {
                    // TODO(b/153319140) remove when we can get this from the above trace invocation
                SystemProperties.set("debug.tracing.screen_state", String.valueOf(state));
                    SystemProperties.set(propertyKey, propertyValue);
                } catch (RuntimeException e) {
                    Slog.e(mTag, "Failed to set a system property: key=" + propertyKey
                            + " value=" + propertyValue + " " + e.getMessage());
                }

                mPowerState.setScreenState(state);
                // Tell battery stats about the transition.
                noteScreenState(state);
@@ -2380,8 +2389,17 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        }
        if (mScreenBrightnessRampAnimator.animateTo(target, sdrTarget, rate)) {
            Trace.traceCounter(Trace.TRACE_TAG_POWER, "TargetScreenBrightness", (int) target);

            String propertyKey = "debug.tracing.screen_brightness";
            String propertyValue = String.valueOf(target);
            try {
                // TODO(b/153319140) remove when we can get this from the above trace invocation
            SystemProperties.set("debug.tracing.screen_brightness", String.valueOf(target));
                SystemProperties.set(propertyKey, propertyValue);
            } catch (RuntimeException e) {
                Slog.e(mTag, "Failed to set a system property: key=" + propertyKey
                        + " value=" + propertyValue + " " + e.getMessage());
            }

            noteScreenBrightness(target);
        }
    }
+22 −4
Original line number Diff line number Diff line
@@ -1947,8 +1947,17 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            if (!reportOnly && mPowerState.getScreenState() != state
                    && readyToUpdateDisplayState()) {
                Trace.traceCounter(Trace.TRACE_TAG_POWER, "ScreenState", state);

                String propertyKey = "debug.tracing.screen_state";
                String propertyValue = String.valueOf(state);
                try {
                    // TODO(b/153319140) remove when we can get this from the above trace invocation
                SystemProperties.set("debug.tracing.screen_state", String.valueOf(state));
                    SystemProperties.set(propertyKey, propertyValue);
                } catch (RuntimeException e) {
                    Slog.e(mTag, "Failed to set a system property: key=" + propertyKey
                            + " value=" + propertyValue + " " + e.getMessage());
                }

                mPowerState.setScreenState(state);
                // Tell battery stats about the transition.
                noteScreenState(state);
@@ -2023,8 +2032,17 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        }
        if (mScreenBrightnessRampAnimator.animateTo(target, sdrTarget, rate)) {
            Trace.traceCounter(Trace.TRACE_TAG_POWER, "TargetScreenBrightness", (int) target);

            String propertyKey = "debug.tracing.screen_brightness";
            String propertyValue = String.valueOf(target);
            try {
                // TODO(b/153319140) remove when we can get this from the above trace invocation
            SystemProperties.set("debug.tracing.screen_brightness", String.valueOf(target));
                SystemProperties.set(propertyKey, propertyValue);
            } catch (RuntimeException e) {
                Slog.e(mTag, "Failed to set a system property: key=" + propertyKey
                        + " value=" + propertyValue + " " + e.getMessage());
            }

            noteScreenBrightness(target);
        }
    }