Merge "Add extra logs to track dozing state changes" into sc-v2-dev am: 217e1d8819
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16102095 Change-Id: I4bad2b603800e51d6439832a46be01110308303f
This commit is contained in:
@@ -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
|
* @param dozing true if dozing, else false
|
||||||
*/
|
*/
|
||||||
public void traceDozing(boolean dozing) {
|
public void traceDozing(boolean dozing) {
|
||||||
@@ -123,6 +123,14 @@ public class DozeLog implements Dumpable {
|
|||||||
mPulsing = false;
|
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
|
* Appends dozing event to the logs
|
||||||
* @param suppressed true if dozing is suppressed
|
* @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) {
|
fun logDozingSuppressed(isDozingSuppressed: Boolean) {
|
||||||
buffer.log(TAG, INFO, {
|
buffer.log(TAG, INFO, {
|
||||||
bool1 = isDozingSuppressed
|
bool1 = isDozingSuppressed
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.os.Handler;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.systemui.Dependency;
|
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.doze.DozeHost;
|
import com.android.systemui.doze.DozeHost;
|
||||||
import com.android.systemui.doze.DozeLog;
|
import com.android.systemui.doze.DozeLog;
|
||||||
@@ -92,10 +91,14 @@ public class DozeScrimController implements StateListener {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DozeScrimController(DozeParameters dozeParameters, DozeLog dozeLog) {
|
public DozeScrimController(
|
||||||
|
DozeParameters dozeParameters,
|
||||||
|
DozeLog dozeLog,
|
||||||
|
StatusBarStateController statusBarStateController
|
||||||
|
) {
|
||||||
mDozeParameters = dozeParameters;
|
mDozeParameters = dozeParameters;
|
||||||
// Never expected to be destroyed
|
// Never expected to be destroyed
|
||||||
Dependency.get(StatusBarStateController.class).addCallback(this);
|
statusBarStateController.addCallback(this);
|
||||||
mDozeLog = dozeLog;
|
mDozeLog = dozeLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +222,10 @@ public class DozeScrimController implements StateListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDozingChanged(boolean isDozing) {
|
public void onDozingChanged(boolean isDozing) {
|
||||||
|
if (mDozing != isDozing) {
|
||||||
|
mDozeLog.traceDozingChanged(isDozing);
|
||||||
|
}
|
||||||
|
|
||||||
setDozing(isDozing);
|
setDozing(isDozing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest;
|
|||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.doze.DozeHost;
|
import com.android.systemui.doze.DozeHost;
|
||||||
import com.android.systemui.doze.DozeLog;
|
import com.android.systemui.doze.DozeLog;
|
||||||
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -44,12 +45,15 @@ public class DozeScrimControllerTest extends SysuiTestCase {
|
|||||||
private DozeParameters mDozeParameters;
|
private DozeParameters mDozeParameters;
|
||||||
@Mock
|
@Mock
|
||||||
private DozeLog mDozeLog;
|
private DozeLog mDozeLog;
|
||||||
|
@Mock
|
||||||
|
private StatusBarStateController mStatusBarStateController;
|
||||||
private DozeScrimController mDozeScrimController;
|
private DozeScrimController mDozeScrimController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
mDozeScrimController = new DozeScrimController(mDozeParameters, mDozeLog);
|
mDozeScrimController = new DozeScrimController(mDozeParameters, mDozeLog,
|
||||||
|
mStatusBarStateController);
|
||||||
mDozeScrimController.setDozing(true);
|
mDozeScrimController.setDozing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user