From 5ae7df18221d1e2ec6838cd1c0d52e8097293a45 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Mon, 30 Mar 2020 17:59:20 +0100 Subject: [PATCH] Add system properties for screen state and brightness. This will allow Perfetto to record the screen state and brightness at the start of a trace. Named the properties "debug.tracing.screen_*" to fit with existing SELinux config and discourage treating this as a general API (there's Display.getState() etc for that). Bug: 152194759 Test: Manual test with "adb shell getprop" Change-Id: I635380f75886e8e1441b77994cb3d2d9d4630e9e --- .../com/android/server/display/DisplayPowerController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index 197842ed1c2d5..1eebe522d4e3b 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -42,6 +42,7 @@ import android.os.Message; import android.os.PowerManager; import android.os.RemoteException; import android.os.SystemClock; +import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; @@ -1238,6 +1239,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call if (!reportOnly) { Trace.traceCounter(Trace.TRACE_TAG_POWER, "ScreenState", state); + // TODO(b/153319140) remove when we can get this from the above trace invocation + SystemProperties.set("debug.tracing.screen_state", String.valueOf(state)); mPowerState.setScreenState(state); // Tell battery stats about the transition. try { @@ -1314,6 +1317,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } if (mScreenBrightnessRampAnimator.animateTo(target, rate)) { Trace.traceCounter(Trace.TRACE_TAG_POWER, "TargetScreenBrightness", (int) target); + // TODO(b/153319140) remove when we can get this from the above trace invocation + SystemProperties.set("debug.tracing.screen_brightness", String.valueOf(target)); try { // TODO(brightnessfloat): change BatteryStats to use float mBatteryStats.noteScreenBrightness(