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

Commit 2d7c9ee5 authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Trace sections for ScreenDecorations

Add new trace sections for ScreenDecorations for debugging jank.

Test: manual
Bug: 259677469
Change-Id: I539a87fc05788f8b01224b110c5afcc04e6c7909
parent d16866aa
Loading
Loading
Loading
Loading
+27 −3
Original line number Diff line number Diff line
@@ -217,8 +217,10 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
                (FaceScanningOverlay) getOverlayView(mFaceScanningViewId);
        if (faceScanningOverlay != null) {
            faceScanningOverlay.setHideOverlayRunnable(() -> {
                Trace.beginSection("ScreenDecorations#hideOverlayRunnable");
                updateOverlayWindowVisibilityIfViewExists(
                        faceScanningOverlay.findViewById(mFaceScanningViewId));
                Trace.endSection();
            });
            faceScanningOverlay.enableShowProtection(false);
        }
@@ -280,16 +282,18 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
            if (mOverlays == null || !shouldOptimizeVisibility()) {
                return;
            }

            Trace.beginSection("ScreenDecorations#updateOverlayWindowVisibilityIfViewExists");
            for (final OverlayWindow overlay : mOverlays) {
                if (overlay == null) {
                    continue;
                }
                if (overlay.getView(view.getId()) != null) {
                    overlay.getRootView().setVisibility(getWindowVisibility(overlay, true));
                    Trace.endSection();
                    return;
                }
            }
            Trace.endSection();
        });
    }

@@ -379,6 +383,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
    }

    private void startOnScreenDecorationsThread() {
        Trace.beginSection("ScreenDecorations#startOnScreenDecorationsThread");
        mWindowManager = mContext.getSystemService(WindowManager.class);
        mDisplayManager = mContext.getSystemService(DisplayManager.class);
        mContext.getDisplay().getDisplayInfo(mDisplayInfo);
@@ -481,6 +486,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {

        mDisplayManager.registerDisplayListener(mDisplayListener, mHandler);
        updateConfiguration();
        Trace.endSection();
    }

    @VisibleForTesting
@@ -530,6 +536,12 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
    }

    private void setupDecorations() {
        Trace.beginSection("ScreenDecorations#setupDecorations");
        setupDecorationsInner();
        Trace.endSection();
    }

    private void setupDecorationsInner() {
        if (hasRoundedCorners() || shouldDrawCutout() || isPrivacyDotEnabled()
                || mFaceScanningFactory.getHasProviders()) {

@@ -582,7 +594,11 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
                return;
            }

            mMainExecutor.execute(() -> mTunerService.addTunable(this, SIZE));
            mMainExecutor.execute(() -> {
                Trace.beginSection("ScreenDecorations#addTunable");
                mTunerService.addTunable(this, SIZE);
                Trace.endSection();
            });

            // Watch color inversion and invert the overlay as needed.
            if (mColorInversionSetting == null) {
@@ -605,7 +621,11 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
                    mExecutor, UserHandle.ALL);
            mIsRegistered = true;
        } else {
            mMainExecutor.execute(() -> mTunerService.removeTunable(this));
            mMainExecutor.execute(() -> {
                Trace.beginSection("ScreenDecorations#removeTunable");
                mTunerService.removeTunable(this);
                Trace.endSection();
            });

            if (mColorInversionSetting != null) {
                mColorInversionSetting.setListening(false);
@@ -951,6 +971,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
        }

        mExecutor.execute(() -> {
            Trace.beginSection("ScreenDecorations#onConfigurationChanged");
            int oldRotation = mRotation;
            mPendingConfigChange = false;
            updateConfiguration();
@@ -963,6 +984,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
                // the updated rotation).
                updateLayoutParams();
            }
            Trace.endSection();
        });
    }

@@ -1131,6 +1153,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
            if (mOverlays == null || !SIZE.equals(key)) {
                return;
            }
            Trace.beginSection("ScreenDecorations#onTuningChanged");
            try {
                final int sizeFactor = Integer.parseInt(newValue);
                mRoundedCornerResDelegate.setTuningSizeFactor(sizeFactor);
@@ -1144,6 +1167,7 @@ public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
                    R.id.rounded_corner_bottom_right
            });
            updateHwLayerRoundedCornerExistAndSize();
            Trace.endSection();
        });
    }