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

Commit 2c8001d2 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add traces to aid onScreenTurnedOn latency debugging" into tm-dev am: b63a6994

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17002644

Change-Id: I7f23f158a59346b8144cd1fcec7cc33faf9dc785
parents 0a5994f5 b63a6994
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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() {
+7 −0
Original line number Diff line number Diff line
@@ -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();
        }
    };

+8 −1
Original line number Diff line number Diff line
@@ -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();