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

Commit 881ac0b1 authored by Fiona Campbell's avatar Fiona Campbell
Browse files

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
parent a7f5bfcd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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