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

This commit is contained in:
Wei Sheng Shih
2021-08-31 01:25:37 +00:00
committed by Android (Google) Code Review
4 changed files with 30 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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));
}
}
/**

View File

@@ -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))));
}
// ================================================================================