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

Commit 9e5bc365 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add traces to aid onScreenTuringOn latency debugging" into tm-dev am: 797572d0

parents e09a222c 797572d0
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.display;

import android.annotation.NonNull;
import android.os.Trace;
import android.util.Slog;
import android.view.Display;
import android.view.DisplayAddress;
@@ -38,6 +39,7 @@ import java.util.function.Consumer;
 */
class DisplayDeviceRepository implements DisplayAdapter.Listener {
    private static final String TAG = "DisplayDeviceRepository";
    private static final Boolean DEBUG = false;

    public static final int DISPLAY_DEVICE_EVENT_ADDED = 1;
    public static final int DISPLAY_DEVICE_EVENT_CHANGED = 2;
@@ -75,6 +77,11 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {

    @Override
    public void onDisplayDeviceEvent(DisplayDevice device, int event) {
        String tag = null;
        if (DEBUG) {
            tag = "DisplayDeviceRepository#onDisplayDeviceEvent (event=" + event + ")";
            Trace.beginAsyncSection(tag, 0);
        }
        switch (event) {
            case DISPLAY_DEVICE_EVENT_ADDED:
                handleDisplayDeviceAdded(device);
@@ -88,6 +95,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
                handleDisplayDeviceRemoved(device);
                break;
        }
        if (DEBUG) {
            Trace.endAsyncSection(tag, 0);
        }
    }

    @Override
@@ -156,7 +166,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {
                Slog.w(TAG, "Attempted to change non-existent display device: " + info);
                return;
            }

            if (DEBUG) {
                Trace.beginSection("handleDisplayDeviceChanged");
            }
            int diff = device.mDebugLastLoggedDeviceInfo.diff(info);
            if (diff == DisplayDeviceInfo.DIFF_STATE) {
                Slog.i(TAG, "Display device changed state: \"" + info.name
@@ -176,6 +188,9 @@ class DisplayDeviceRepository implements DisplayAdapter.Listener {

            device.applyPendingDisplayDeviceInfoChangesLocked();
            sendEventLocked(device, DISPLAY_DEVICE_EVENT_CHANGED);
            if (DEBUG) {
                Trace.endSection();
            }
        }
    }

+6 −0
Original line number Diff line number Diff line
@@ -791,7 +791,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                mDisplayStatsId = mUniqueDisplayId.hashCode();
                mDisplayDeviceConfig = config;
                loadFromDisplayDeviceConfig(token, info);
                if (DEBUG) {
                    Trace.beginAsyncSection("DisplayPowerController#updatePowerState", 0);
                }
                updatePowerState();
                if (DEBUG) {
                    Trace.endAsyncSection("DisplayPowerController#updatePowerState", 0);
                }
            }
        });
    }
+7 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.display;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.Mode.INVALID_MODE_ID;

import android.app.ActivityThread;
@@ -1408,7 +1409,12 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        }

        public boolean getBootDisplayModeSupport() {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "getBootDisplayModeSupport");
            try {
                return SurfaceControl.getBootDisplayModeSupport();
            } finally {
                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            }
        }

        public void setBootDisplayMode(IBinder displayToken, int modeId) {