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

Commit 2c9160c3 authored by wilsonshih's avatar wilsonshih
Browse files

Add trace for tracking the performance of new starting window

Analysis performance.

Bug: 173975965
Test: check perfetto
Change-Id: Id0cf1b23799fd8bb0193c950ae4320ccca9dfac0
parent 998666c4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.window;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;

import android.annotation.ColorInt;
@@ -32,6 +33,7 @@ import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
@@ -183,6 +185,7 @@ public final class SplashScreenView extends FrameLayout {
         * Create SplashScreenWindowView object from materials.
         */
        public SplashScreenView build() {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "SplashScreenView#build");
            final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
            final SplashScreenView view = (SplashScreenView)
                    layoutInflater.inflate(R.layout.splash_screen_view, null, false);
@@ -226,6 +229,7 @@ public final class SplashScreenView extends FrameLayout {
                        + view.mBrandingImageView + " drawable: " + mBrandingDrawable
                        + " size w: " + mBrandingImageWidth + " h: " + mBrandingImageHeight);
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            return view;
        }
    }
+14 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.wm.shell.startingsurface;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;

import android.annotation.ColorInt;
import android.annotation.NonNull;
import android.app.ActivityThread;
@@ -31,6 +33,7 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.os.Trace;
import android.util.Slog;
import android.view.SurfaceControl;
import android.window.SplashScreenView;
@@ -110,7 +113,8 @@ public class SplashscreenContentDrawer {
        return new ColorDrawable(getSystemBGColor());
    }

    @ColorInt int peekWindowBGColor(Context context) {
    private @ColorInt int peekWindowBGColor(Context context) {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "peekWindowBGColor");
        final Drawable themeBGDrawable;
        if (mTmpAttrs.mWindowBgColor != 0) {
            themeBGDrawable = new ColorDrawable(mTmpAttrs.mWindowBgColor);
@@ -120,7 +124,9 @@ public class SplashscreenContentDrawer {
            Slog.w(TAG, "Window background not exist!");
            themeBGDrawable = createDefaultBackgroundDrawable();
        }
        return estimateWindowBGColor(themeBGDrawable);
        final int estimatedWindowBGColor = estimateWindowBGColor(themeBGDrawable);
        Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        return estimatedWindowBGColor;
    }

    private int estimateWindowBGColor(Drawable themeBGDrawable) {
@@ -278,6 +284,7 @@ public class SplashscreenContentDrawer {
                return false;
            }

            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "processAdaptiveIcon");
            final AdaptiveIconDrawable adaptiveIconDrawable = (AdaptiveIconDrawable) mIconDrawable;
            final DrawableColorTester backIconTester =
                    new DrawableColorTester(adaptiveIconDrawable.getBackground());
@@ -329,11 +336,13 @@ public class SplashscreenContentDrawer {
                }
                createIconDrawable(adaptiveIconDrawable, mIconSize);
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            return true;
        }

        private SplashScreenView fillViewWithIcon(Context context,
                int iconSize, Drawable iconDrawable) {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "fillViewWithIcon");
            final SplashScreenView.Builder builder = new SplashScreenView.Builder(context);
            builder.setIconSize(iconSize).setBackgroundColor(mThemeColor)
                    .setIconBackground(mIconBackground);
@@ -350,6 +359,7 @@ public class SplashscreenContentDrawer {
                Slog.d(TAG, "fillViewWithIcon surfaceWindowView " + splashScreenView);
            }
            splashScreenView.makeSystemUIColorsTransparent();
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            return splashScreenView;
        }
    }
@@ -511,6 +521,7 @@ public class SplashscreenContentDrawer {
                    new TransparentFilterQuantizer();

            ComplexDrawableTester(Drawable drawable, boolean filterTransparent) {
                Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "ComplexDrawableTester");
                final Rect initialBounds = drawable.copyBounds();
                int width = drawable.getIntrinsicWidth();
                int height = drawable.getIntrinsicHeight();
@@ -545,6 +556,7 @@ public class SplashscreenContentDrawer {
                }
                mPalette = builder.generate();
                bitmap.recycle();
                Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            }

            @Override