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

Commit e9ab2687 authored by Beverly's avatar Beverly
Browse files

Add debugging logs for Doze

Test: manual
Bug: 168778910
Change-Id: If6c89df1a426fb2f15abf1d53567b5a72d4aab5f
parent 143e6754
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -197,6 +197,22 @@ public class DozeLog implements Dumpable {
        mLogger.logDozeStateChanged(state);
    }

    /**
     * Appends doze state changed sent to all DozeMachine parts event to the logs
     * @param state new DozeMachine state
     */
    public void traceDozeStateSendComplete(DozeMachine.State state) {
        mLogger.logStateChangedSent(state);
    }

    /**
     * Appends display state changed event to the logs
     * @param displayState new DozeMachine state
     */
    public void traceDisplayState(int displayState) {
        mLogger.logDisplayStateChanged(displayState);
    }

    /**
     * Appends wake-display event to the logs.
     * @param wake if we're waking up or sleeping.
+16 −0
Original line number Diff line number Diff line
@@ -143,6 +143,22 @@ class DozeLogger @Inject constructor(
        })
    }

    fun logStateChangedSent(state: DozeMachine.State) {
        buffer.log(TAG, INFO, {
            str1 = state.name
        }, {
            "Doze state sent to all DozeMachineParts stateSent=$str1"
        })
    }

    fun logDisplayStateChanged(displayState: Int) {
        buffer.log(TAG, INFO, {
            int1 = displayState
        }, {
            "Display state changed to $int1"
        })
    }

    fun logWakeDisplay(isAwake: Boolean) {
        buffer.log(TAG, DEBUG, {
            bool1 = isAwake
+2 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@ public class DozeMachine {
    }

    void onScreenState(int state) {
        mDozeLog.traceDisplayState(state);
        for (Part part : mParts) {
            part.onScreenState(state);
        }
@@ -308,6 +309,7 @@ public class DozeMachine {
        for (Part p : mParts) {
            p.transitionTo(oldState, newState);
        }
        mDozeLog.traceDozeStateSendComplete(newState);

        switch (newState) {
            case FINISH:
+6 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.systemui.doze.dagger.DozeScope;
import com.android.systemui.doze.dagger.WrappedService;
import com.android.systemui.util.sensors.AsyncSensorManager;

import java.io.PrintWriter;
import java.util.Optional;

import javax.inject.Inject;
@@ -221,4 +222,9 @@ public class DozeScreenBrightness extends BroadcastReceiver implements DozeMachi
        mDebugBrightnessBucket = intent.getIntExtra(BRIGHTNESS_BUCKET, -1);
        updateBrightnessAndReady(false /* force */);
    }

    /** Dump current state */
    public void dump(PrintWriter pw) {
        pw.println("DozeScreenBrightnessSensorRegistered=" + mRegistered);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ class ThresholdSensorImpl implements ThresholdSensor {

    @Override
    public String toString() {
        return String.format("{registered=%s, paused=%s, threshold=%s, sensor=%s}",
        return String.format("{isLoaded=%s, registered=%s, paused=%s, threshold=%s, sensor=%s}",
                isLoaded(), mRegistered, mPaused, mThreshold, mSensor);
    }