Add extra logs to track dozing state changes

When starting AOD

Test: manual see logs
Bug: 202630143

Change-Id: Ib78145e068ea40dd727980b4845c8b2d5e250d1f
This commit is contained in:
Beverly
2021-10-21 09:26:44 -04:00
committed by Beverly Tai
parent 9c0537028d
commit ba95ea351e
4 changed files with 33 additions and 6 deletions

View File

@@ -115,7 +115,7 @@ public class DozeLog implements Dumpable {
}
/**
* Appends dozing event to the logs
* Appends dozing event to the logs. Logs current dozing state when entering/exiting AOD.
* @param dozing true if dozing, else false
*/
public void traceDozing(boolean dozing) {
@@ -123,6 +123,14 @@ public class DozeLog implements Dumpable {
mPulsing = false;
}
/**
* Appends dozing event to the logs when dozing has changed in AOD.
* @param dozing true if we're now dozing, else false
*/
public void traceDozingChanged(boolean dozing) {
mLogger.logDozingChanged(dozing);
}
/**
* Appends dozing event to the logs
* @param suppressed true if dozing is suppressed

View File

@@ -66,6 +66,14 @@ class DozeLogger @Inject constructor(
})
}
fun logDozingChanged(isDozing: Boolean) {
buffer.log(TAG, INFO, {
bool1 = isDozing
}, {
"Dozing changed dozing=$bool1"
})
}
fun logDozingSuppressed(isDozingSuppressed: Boolean) {
buffer.log(TAG, INFO, {
bool1 = isDozingSuppressed

View File

@@ -21,7 +21,6 @@ import android.os.Handler;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dependency;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.doze.DozeHost;
import com.android.systemui.doze.DozeLog;
@@ -92,10 +91,14 @@ public class DozeScrimController implements StateListener {
};
@Inject
public DozeScrimController(DozeParameters dozeParameters, DozeLog dozeLog) {
public DozeScrimController(
DozeParameters dozeParameters,
DozeLog dozeLog,
StatusBarStateController statusBarStateController
) {
mDozeParameters = dozeParameters;
//Never expected to be destroyed
Dependency.get(StatusBarStateController.class).addCallback(this);
// Never expected to be destroyed
statusBarStateController.addCallback(this);
mDozeLog = dozeLog;
}
@@ -219,6 +222,10 @@ public class DozeScrimController implements StateListener {
@Override
public void onDozingChanged(boolean isDozing) {
if (mDozing != isDozing) {
mDozeLog.traceDozingChanged(isDozing);
}
setDozing(isDozing);
}
}

View File

@@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.doze.DozeHost;
import com.android.systemui.doze.DozeLog;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import org.junit.Before;
import org.junit.Test;
@@ -44,12 +45,15 @@ public class DozeScrimControllerTest extends SysuiTestCase {
private DozeParameters mDozeParameters;
@Mock
private DozeLog mDozeLog;
@Mock
private StatusBarStateController mStatusBarStateController;
private DozeScrimController mDozeScrimController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mDozeScrimController = new DozeScrimController(mDozeParameters, mDozeLog);
mDozeScrimController = new DozeScrimController(mDozeParameters, mDozeLog,
mStatusBarStateController);
mDozeScrimController.setDozing(true);
}