Merge "Add traces to aid onScreenTurnedOn latency debugging" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b63a699489
@@ -4,6 +4,7 @@ import android.hardware.Sensor
|
||||
import android.hardware.SensorEvent
|
||||
import android.hardware.SensorEventListener
|
||||
import android.hardware.SensorManager
|
||||
import android.os.Trace
|
||||
import androidx.core.util.Consumer
|
||||
|
||||
internal class HingeSensorAngleProvider(private val sensorManager: SensorManager) :
|
||||
@@ -13,8 +14,10 @@ internal class HingeSensorAngleProvider(private val sensorManager: SensorManager
|
||||
private val listeners: MutableList<Consumer<Float>> = arrayListOf()
|
||||
|
||||
override fun start() {
|
||||
Trace.beginSection("HingeSensorAngleProvider#start")
|
||||
val sensor = sensorManager.getDefaultSensor(Sensor.TYPE_HINGE_ANGLE)
|
||||
sensorManager.registerListener(sensorListener, sensor, SensorManager.SENSOR_DELAY_FASTEST)
|
||||
Trace.endSection()
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.hardware.display.DisplayManager;
|
||||
import android.media.MediaRouter;
|
||||
import android.media.MediaRouter.RouteInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
@@ -67,11 +68,14 @@ public class KeyguardDisplayManager {
|
||||
|
||||
@Override
|
||||
public void onDisplayAdded(int displayId) {
|
||||
Trace.beginSection(
|
||||
"KeyguardDisplayManager#onDisplayAdded(displayId=" + displayId + ")");
|
||||
final Display display = mDisplayService.getDisplay(displayId);
|
||||
if (mShowing) {
|
||||
updateNavigationBarVisibility(displayId, false /* navBarVisible */);
|
||||
showPresentation(display);
|
||||
}
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,7 +85,10 @@ public class KeyguardDisplayManager {
|
||||
|
||||
@Override
|
||||
public void onDisplayRemoved(int displayId) {
|
||||
Trace.beginSection(
|
||||
"KeyguardDisplayManager#onDisplayRemoved(displayId=" + displayId + ")");
|
||||
hidePresentation(displayId);
|
||||
Trace.endSection();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ package com.android.systemui.keyguard;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||
@@ -83,6 +83,11 @@ public class KeyguardLifecyclesDispatcher {
|
||||
final Object obj = msg.obj;
|
||||
switch (msg.what) {
|
||||
case SCREEN_TURNING_ON:
|
||||
Trace.beginSection("KeyguardLifecyclesDispatcher#SCREEN_TURNING_ON");
|
||||
final String onDrawWaitingTraceTag =
|
||||
"Waiting for KeyguardDrawnCallback#onDrawn";
|
||||
int traceCookie = System.identityHashCode(msg);
|
||||
Trace.beginAsyncSection(onDrawWaitingTraceTag, traceCookie);
|
||||
// Ensure the drawn callback is only ever called once
|
||||
mScreenLifecycle.dispatchScreenTurningOn(new Runnable() {
|
||||
boolean mInvoked;
|
||||
@@ -92,6 +97,7 @@ public class KeyguardLifecyclesDispatcher {
|
||||
if (!mInvoked) {
|
||||
mInvoked = true;
|
||||
try {
|
||||
Trace.endAsyncSection(onDrawWaitingTraceTag, traceCookie);
|
||||
((IKeyguardDrawnCallback) obj).onDrawn();
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Exception calling onDrawn():", e);
|
||||
@@ -101,6 +107,7 @@ public class KeyguardLifecyclesDispatcher {
|
||||
}
|
||||
}
|
||||
});
|
||||
Trace.endSection();
|
||||
break;
|
||||
case SCREEN_TURNED_ON:
|
||||
mScreenLifecycle.dispatchScreenTurnedOn();
|
||||
|
||||
Reference in New Issue
Block a user