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

Commit db3d82a4 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Starting window performance tuning.(8/N)" into sc-dev

parents 242cc497 11598e82
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -396,6 +396,12 @@ public class Process {
     */
    public static final int THREAD_PRIORITY_VIDEO = -10;

    /**
     * Priority we boost main thread and RT of top app to.
     * @hide
     */
    public static final int THREAD_PRIORITY_TOP_APP_BOOST = -10;

    /**
     * Standard priority of audio threads.  Applications can not normally
     * change to this priority.
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public class TaskOrganizer extends WindowOrganizer {
    /** @hide */
    @VisibleForTesting
    public TaskOrganizer(ITaskOrganizerController taskOrganizerController, Executor executor) {
        mExecutor = executor != null ? executor : command -> command.run();
        mExecutor = executor != null ? executor : Runnable::run;
        mTaskOrganizerController = taskOrganizerController != null
                ? taskOrganizerController : getController();
    }
+1 −3
Original line number Diff line number Diff line
@@ -184,10 +184,8 @@ public class ShellTaskOrganizer extends TaskOrganizer {
     * @hide
     */
    public void initStartingSurface(StartingSurface startingSurface) {
        synchronized (mLock) {
        mStartingSurface = startingSurface;
    }
    }

    /**
     * Adds a listener for a specific task id.
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.common.annotations;


import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import javax.inject.Qualifier;

/** Annotates a method or qualifies a provider that runs on the Shell splashscreen-thread */
@Documented
@Inherited
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
public @interface ShellSplashscreenThread {
}
+8 −19
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Build;
import android.util.Slog;
import android.view.Window;
import android.window.SplashScreenView;

import com.android.internal.R;
@@ -91,12 +90,13 @@ public class SplashscreenContentDrawer {
        return new ColorDrawable(getSystemBGColor());
    }

    SplashScreenView makeSplashScreenContentView(Window win, Context context, int iconRes,
    SplashScreenView makeSplashScreenContentView(Context context, int iconRes,
            int splashscreenContentResId) {
        updateDensity();
        // splash screen content will be deprecated after S.
        final SplashScreenView ssc =
                makeSplashscreenContentDrawable(win, context, splashscreenContentResId);
                makeSplashscreenContentDrawable(context, splashscreenContentResId);

        if (ssc != null) {
            return ssc;
        }
@@ -127,7 +127,6 @@ public class SplashscreenContentDrawer {
        }
        // TODO (b/173975965) Tracking the performance on improved splash screen.
        return builder
                .setWindow(win)
                .setContext(context)
                .setThemeDrawable(themeBGDrawable)
                .setIconDrawable(iconDrawable)
@@ -169,7 +168,6 @@ public class SplashscreenContentDrawer {
    private class StartingWindowViewBuilder {
        private Drawable mThemeBGDrawable;
        private Drawable mIconDrawable;
        private Window mWindow;
        private int mIconAnimationDuration;
        private Context mContext;
        private Drawable mBrandingDrawable;
@@ -193,12 +191,6 @@ public class SplashscreenContentDrawer {
            return this;
        }

        StartingWindowViewBuilder setWindow(Window window) {
            mWindow = window;
            mBuildComplete = false;
            return this;
        }

        StartingWindowViewBuilder setIconAnimationDuration(int iconAnimationDuration) {
            mIconAnimationDuration = iconAnimationDuration;
            mBuildComplete = false;
@@ -221,7 +213,7 @@ public class SplashscreenContentDrawer {
            if (mBuildComplete) {
                return mCachedResult;
            }
            if (mWindow == null || mContext == null) {
            if (mContext == null) {
                Slog.e(TAG, "Unable to create StartingWindowView, lack of materials!");
                return null;
            }
@@ -237,7 +229,7 @@ public class SplashscreenContentDrawer {
                mFinalIconDrawable = mIconDrawable;
            }
            final int iconSize = mFinalIconDrawable != null ? (int) (mIconSize * mScale) : 0;
            mCachedResult = fillViewWithIcon(mWindow, mContext, iconSize, mFinalIconDrawable);
            mCachedResult = fillViewWithIcon(mContext, iconSize, mFinalIconDrawable);
            mBuildComplete = true;
            return mCachedResult;
        }
@@ -313,7 +305,7 @@ public class SplashscreenContentDrawer {
            return true;
        }

        private SplashScreenView fillViewWithIcon(Window win, Context context,
        private SplashScreenView fillViewWithIcon(Context context,
                int iconSize, Drawable iconDrawable) {
            final SplashScreenView.Builder builder = new SplashScreenView.Builder(context);
            builder.setIconSize(iconSize).setBackgroundColor(mThemeColor);
@@ -329,8 +321,6 @@ public class SplashscreenContentDrawer {
            if (DEBUG) {
                Slog.d(TAG, "fillViewWithIcon surfaceWindowView " + splashScreenView);
            }
            win.setContentView(splashScreenView);
            splashScreenView.cacheRootWindow(win);
            splashScreenView.makeSystemUIColorsTransparent();
            return splashScreenView;
        }
@@ -363,8 +353,8 @@ public class SplashscreenContentDrawer {
        return root < 0.1;
    }

    private static SplashScreenView makeSplashscreenContentDrawable(Window win,
            Context ctx, int splashscreenContentResId) {
    private static SplashScreenView makeSplashscreenContentDrawable(Context ctx,
            int splashscreenContentResId) {
        // doesn't support windowSplashscreenContent after S
        // TODO add an allowlist to skip some packages if needed
        final int targetSdkVersion = ctx.getApplicationInfo().targetSdkVersion;
@@ -384,7 +374,6 @@ public class SplashscreenContentDrawer {
        SplashScreenView view = new SplashScreenView(ctx);
        view.setNotCopyable();
        view.setBackground(drawable);
        win.setContentView(view);
        return view;
    }

Loading