Merge "Add extra logs to track dozing state changes" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
217e1d8819
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user