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

Commit 97c31313 authored by wilsonshih's avatar wilsonshih
Browse files

Send request top ui to SystemUI when creating splash screen.

Boost SystemUI's RenderThread to top-app when creating splash screen.

Bug: 195736516
Test: build and flash
Change-Id: Ie6589ec8abf0b3ab799b79ca12cc506cf2b4abdb
parent 793bcbcb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -36,4 +36,12 @@ public interface StartingSurface {
    default int getBackgroundColor(TaskInfo taskInfo) {
        return Color.BLACK;
    }

    /** Set the proxy to communicate with SysUi side components. */
    void setSysuiProxy(SysuiProxy proxy);

    /** Callback to tell SysUi components execute some methods. */
    interface SysuiProxy {
        void requestTopUi(boolean requestTopUi, String componentTag);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ public class StartingSurfaceDrawer {
    final SplashscreenContentDrawer mSplashscreenContentDrawer;
    private Choreographer mChoreographer;
    private final WindowManagerGlobal mWindowManagerGlobal;
    private StartingSurface.SysuiProxy mSysuiProxy;

    /**
     * @param splashScreenExecutor The thread used to control add and remove starting window.
@@ -151,6 +152,11 @@ public class StartingSurfaceDrawer {
                : activityInfo.getThemeResource() != 0 ? activityInfo.getThemeResource()
                        : com.android.internal.R.style.Theme_DeviceDefault_DayNight;
    }

    void setSysuiProxy(StartingSurface.SysuiProxy sysuiProxy) {
        mSysuiProxy = sysuiProxy;
    }

    /**
     * Called when a task need a splash screen starting window.
     *
@@ -317,6 +323,9 @@ public class StartingSurfaceDrawer {
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        };
        if (mSysuiProxy != null) {
            mSysuiProxy.requestTopUi(true, TAG);
        }
        mSplashscreenContentDrawer.createContentView(context, suggestType, activityInfo, taskId,
                viewSupplier::setView);
        try {
@@ -573,6 +582,9 @@ public class StartingSurfaceDrawer {
    }

    private void removeWindowInner(View decorView, boolean hideView) {
        if (mSysuiProxy != null) {
            mSysuiProxy.requestTopUi(false, TAG);
        }
        if (hideView) {
            decorView.setVisibility(View.GONE);
        }
+5 −0
Original line number Diff line number Diff line
@@ -217,6 +217,11 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo
            return color != Color.TRANSPARENT
                    ? color : SplashscreenContentDrawer.getSystemBGColor();
        }

        @Override
        public void setSysuiProxy(SysuiProxy proxy) {
            mSplashScreenExecutor.execute(() -> mStartingSurfaceDrawer.setSysuiProxy(proxy));
        }
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -1089,6 +1089,11 @@ public class StatusBar extends SystemUI implements
                        }
                    }
                }, OverlayPlugin.class, true /* Allow multiple plugins */);

        mStartingSurfaceOptional.ifPresent(startingSurface -> startingSurface.setSysuiProxy(
                (requestTopUi, componentTag) -> mMainExecutor.execute(() ->
                        mNotificationShadeWindowController.setRequestTopUi(
                                requestTopUi, componentTag))));
    }

    // ================================================================================