diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl index f562c8fc4f859..630c8e7575b28 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl @@ -25,6 +25,7 @@ interface IStartingWindowListener { * Notifies when Shell going to create a new starting window. * @param taskId The task Id * @param supportedType The starting window type + * @param splashScreenBackgroundColor The splash screen's background color */ - oneway void onTaskLaunching(int taskId, int supportedType); + oneway void onTaskLaunching(int taskId, int supportedType, int splashScreenBackgroundColor); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java index 8463da6a0ecb9..c72a535fa329d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java @@ -32,6 +32,7 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PixelFormat; import android.graphics.Rect; +import android.graphics.drawable.ColorDrawable; import android.hardware.display.DisplayManager; import android.os.IBinder; import android.os.SystemProperties; @@ -326,6 +327,12 @@ public class StartingSurfaceDrawer { } } + int getStartingWindowBackgroundColorForTask(int taskId) { + StartingWindowRecord startingWindowRecord = mStartingWindowRecords.get(taskId); + if (startingWindowRecord == null || startingWindowRecord.mContentView == null) return 0; + return ((ColorDrawable) startingWindowRecord.mContentView.getBackground()).getColor(); + } + private static class SplashScreenViewSupplier implements Supplier { private SplashScreenView mView; private boolean mIsViewSet; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java index cb7afc77a65bd..cffc789106cb0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java @@ -36,12 +36,11 @@ import android.window.TaskSnapshot; import androidx.annotation.BinderThread; +import com.android.internal.util.function.TriConsumer; import com.android.wm.shell.common.RemoteCallable; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.TransactionPool; -import java.util.function.BiConsumer; - /** * Implementation to draw the starting window to an application, and remove the starting window * until the application displays its own window. @@ -68,7 +67,7 @@ public class StartingWindowController implements RemoteCallable mTaskLaunchingCallback; + private TriConsumer mTaskLaunchingCallback; private final StartingSurfaceImpl mImpl = new StartingSurfaceImpl(); private final Context mContext; private final ShellExecutor mSplashScreenExecutor; @@ -103,7 +102,7 @@ public class StartingWindowController implements RemoteCallable listener) { + void setStartingWindowListener(TriConsumer listener) { mTaskLaunchingCallback = listener; } @@ -121,9 +120,6 @@ public class StartingWindowController implements RemoteCallable mStartingWindowListener = + private final TriConsumer mStartingWindowListener = this::notifyIStartingWindowListener; private final IBinder.DeathRecipient mListenerDeathRecipient = new IBinder.DeathRecipient() { @@ -230,13 +231,14 @@ public class StartingWindowController implements RemoteCallable