Make BrightnessEvent use local device time

- Change formatting of time to the same as BrightnessTracker
- This formatting also corrects the timezone to local timezone.

Bug: 275710016
Test: adb shell dumpsys display | grep BrightnessEvent
Test: adb shell dumpsys display | grep BrightnessTracker -A20
Change-Id: I183b445f84a8807e2d97a7b5364224db9db8f85f
This commit is contained in:
Fiona Campbell
2023-07-21 11:56:50 +00:00
parent a7f5bfcdfb
commit 881ac0b16d

View File

@@ -19,10 +19,12 @@ package com.android.server.display.brightness;
import android.hardware.display.BrightnessInfo;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.TimeUtils;
import com.android.internal.annotations.VisibleForTesting;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Represents a particular brightness change event.
*/
@@ -34,6 +36,8 @@ public final class BrightnessEvent {
public static final int FLAG_IDLE_CURVE = 0x10;
public static final int FLAG_LOW_POWER_MODE = 0x20;
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("MM-dd HH:mm:ss.SSS");
private BrightnessReason mReason = new BrightnessReason();
private int mDisplayId;
private String mPhysicalDisplayId;
@@ -169,7 +173,7 @@ public final class BrightnessEvent {
* @return A stringified BrightnessEvent
*/
public String toString(boolean includeTime) {
return (includeTime ? TimeUtils.formatForLogging(mTime) + " - " : "")
return (includeTime ? FORMAT.format(new Date(mTime)) + " - " : "")
+ "BrightnessEvent: "
+ "disp=" + mDisplayId
+ ", physDisp=" + mPhysicalDisplayId