Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -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); } libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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<SplashScreenView> { private SplashScreenView mView; private boolean mIsViewSet; Loading libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java +12 −10 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -68,7 +67,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo private final StartingSurfaceDrawer mStartingSurfaceDrawer; private final StartingWindowTypeAlgorithm mStartingWindowTypeAlgorithm; private BiConsumer<Integer, Integer> mTaskLaunchingCallback; private TriConsumer<Integer, Integer, Integer> mTaskLaunchingCallback; private final StartingSurfaceImpl mImpl = new StartingSurfaceImpl(); private final Context mContext; private final ShellExecutor mSplashScreenExecutor; Loading Loading @@ -103,7 +102,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo * * @param listener The callback when need a starting window. */ void setStartingWindowListener(BiConsumer<Integer, Integer> listener) { void setStartingWindowListener(TriConsumer<Integer, Integer, Integer> listener) { mTaskLaunchingCallback = listener; } Loading @@ -121,9 +120,6 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo final int suggestionType = mStartingWindowTypeAlgorithm.getSuggestedWindowType( windowInfo); final RunningTaskInfo runningTaskInfo = windowInfo.taskInfo; if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) { mTaskLaunchingCallback.accept(runningTaskInfo.taskId, suggestionType); } if (suggestionType == STARTING_WINDOW_TYPE_SPLASH_SCREEN) { mStartingSurfaceDrawer.addSplashScreenStartingWindow(windowInfo, appToken, false /* emptyView */); Loading @@ -137,6 +133,11 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo } else /* suggestionType == STARTING_WINDOW_TYPE_NONE */ { // Don't add a staring window. } if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) { int taskId = runningTaskInfo.taskId; int color = mStartingSurfaceDrawer.getStartingWindowBackgroundColorForTask(taskId); mTaskLaunchingCallback.accept(taskId, suggestionType, color); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); }); Loading Loading @@ -181,7 +182,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo private static class IStartingWindowImpl extends IStartingWindow.Stub { private StartingWindowController mController; private IStartingWindowListener mListener; private final BiConsumer<Integer, Integer> mStartingWindowListener = private final TriConsumer<Integer, Integer, Integer> mStartingWindowListener = this::notifyIStartingWindowListener; private final IBinder.DeathRecipient mListenerDeathRecipient = new IBinder.DeathRecipient() { Loading Loading @@ -230,13 +231,14 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo }); } private void notifyIStartingWindowListener(int taskId, int supportedType) { private void notifyIStartingWindowListener(int taskId, int supportedType, int startingWindowBackgroundColor) { if (mListener == null) { return; } try { mListener.onTaskLaunching(taskId, supportedType); mListener.onTaskLaunching(taskId, supportedType, startingWindowBackgroundColor); } catch (RemoteException e) { Slog.e(TAG, "Failed to notify task launching", e); } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/IStartingWindowListener.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -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); }
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingSurfaceDrawer.java +7 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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<SplashScreenView> { private SplashScreenView mView; private boolean mIsViewSet; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/StartingWindowController.java +12 −10 Original line number Diff line number Diff line Loading @@ -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. Loading @@ -68,7 +67,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo private final StartingSurfaceDrawer mStartingSurfaceDrawer; private final StartingWindowTypeAlgorithm mStartingWindowTypeAlgorithm; private BiConsumer<Integer, Integer> mTaskLaunchingCallback; private TriConsumer<Integer, Integer, Integer> mTaskLaunchingCallback; private final StartingSurfaceImpl mImpl = new StartingSurfaceImpl(); private final Context mContext; private final ShellExecutor mSplashScreenExecutor; Loading Loading @@ -103,7 +102,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo * * @param listener The callback when need a starting window. */ void setStartingWindowListener(BiConsumer<Integer, Integer> listener) { void setStartingWindowListener(TriConsumer<Integer, Integer, Integer> listener) { mTaskLaunchingCallback = listener; } Loading @@ -121,9 +120,6 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo final int suggestionType = mStartingWindowTypeAlgorithm.getSuggestedWindowType( windowInfo); final RunningTaskInfo runningTaskInfo = windowInfo.taskInfo; if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) { mTaskLaunchingCallback.accept(runningTaskInfo.taskId, suggestionType); } if (suggestionType == STARTING_WINDOW_TYPE_SPLASH_SCREEN) { mStartingSurfaceDrawer.addSplashScreenStartingWindow(windowInfo, appToken, false /* emptyView */); Loading @@ -137,6 +133,11 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo } else /* suggestionType == STARTING_WINDOW_TYPE_NONE */ { // Don't add a staring window. } if (mTaskLaunchingCallback != null && shouldSendToListener(suggestionType)) { int taskId = runningTaskInfo.taskId; int color = mStartingSurfaceDrawer.getStartingWindowBackgroundColorForTask(taskId); mTaskLaunchingCallback.accept(taskId, suggestionType, color); } Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); }); Loading Loading @@ -181,7 +182,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo private static class IStartingWindowImpl extends IStartingWindow.Stub { private StartingWindowController mController; private IStartingWindowListener mListener; private final BiConsumer<Integer, Integer> mStartingWindowListener = private final TriConsumer<Integer, Integer, Integer> mStartingWindowListener = this::notifyIStartingWindowListener; private final IBinder.DeathRecipient mListenerDeathRecipient = new IBinder.DeathRecipient() { Loading Loading @@ -230,13 +231,14 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo }); } private void notifyIStartingWindowListener(int taskId, int supportedType) { private void notifyIStartingWindowListener(int taskId, int supportedType, int startingWindowBackgroundColor) { if (mListener == null) { return; } try { mListener.onTaskLaunching(taskId, supportedType); mListener.onTaskLaunching(taskId, supportedType, startingWindowBackgroundColor); } catch (RemoteException e) { Slog.e(TAG, "Failed to notify task launching", e); } Loading