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

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

Merge "Send request top ui to SystemUI when creating splash screen." into sc-v2-dev

parents 988a050f 97c31313
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))));
    }

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