Loading core/java/android/window/StartingWindowInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,13 @@ public final class StartingWindowInfo implements Parcelable { */ public static final int TYPE_PARAMETER_WINDOWLESS = 0x00000100; /** * Application has set Window_windowSplashScreenBehavior to * SPLASH_SCREEN_BEHAVIOR_ICON_PREFERRED. * @hide */ public static final int TYPE_PARAMETER_APP_PREFERS_ICON = 0x00000200; /** * Application is allowed to use the legacy splash screen * @hide Loading libs/WindowManager/Shell/res/values-television/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -57,4 +57,9 @@ - 0 for radial vanish + slide up - 1 for fade out --> <integer name="starting_window_exit_animation_type">1</integer> <!-- Whether this device allows to use the appIcon as a fallback icon for the splash screen window. If false, the splash screen will be a solid color splash screen whenever the app has not provided a windowSplashScreenAnimatedIcon. --> <bool name="config_canUseAppIconForSplashScreen">false</bool> </resources> libs/WindowManager/Shell/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -136,4 +136,9 @@ <!-- Whether DragAndDrop capability is enabled --> <bool name="config_enableShellDragDrop">true</bool> <!-- Whether this device allows to use the appIcon as a fallback icon for the splash screen window. If false, the splash screen will be a solid color splash screen whenever the app has not provided a windowSplashScreenAnimatedIcon. --> <bool name="config_canUseAppIconForSplashScreen">true</bool> </resources> libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +14 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SPLASH_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_APP_PREFERS_ICON; import android.annotation.ColorInt; import android.annotation.IntDef; Loading Loading @@ -125,6 +126,7 @@ public class SplashscreenContentDrawer { private final TransactionPool mTransactionPool; private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); private final Handler mSplashscreenWorkerHandler; private final boolean mCanUseAppIconForSplashScreen; @VisibleForTesting final ColorCache mColorCache; Loading @@ -141,6 +143,8 @@ public class SplashscreenContentDrawer { shellSplashscreenWorkerThread.start(); mSplashscreenWorkerHandler = shellSplashscreenWorkerThread.getThreadHandler(); mColorCache = new ColorCache(mContext, mSplashscreenWorkerHandler); mCanUseAppIconForSplashScreen = context.getResources().getBoolean( com.android.wm.shell.R.bool.config_canUseAppIconForSplashScreen); } /** Loading Loading @@ -427,7 +431,10 @@ public class SplashscreenContentDrawer { getWindowAttrs(context, mTmpAttrs); mLastPackageContextConfigHash = context.getResources().getConfiguration().hashCode(); final Drawable legacyDrawable = suggestType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN final @StartingWindowType int splashType = suggestType == STARTING_WINDOW_TYPE_SPLASH_SCREEN && !canUseIcon(info) ? STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN : suggestType; final Drawable legacyDrawable = splashType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN ? peekLegacySplashscreenContent(context, mTmpAttrs) : null; final ActivityInfo ai = info.targetActivityInfo != null ? info.targetActivityInfo Loading @@ -439,12 +446,17 @@ public class SplashscreenContentDrawer { return new SplashViewBuilder(context, ai) .setWindowBGColor(themeBGColor) .overlayDrawable(legacyDrawable) .chooseStyle(suggestType) .chooseStyle(splashType) .setUiThreadInitConsumer(uiThreadInitConsumer) .setAllowHandleSolidColor(info.allowHandleSolidColorSplashScreen()) .build(); } private boolean canUseIcon(StartingWindowInfo info) { return mCanUseAppIconForSplashScreen || mTmpAttrs.mSplashScreenIcon != null || (info.startingWindowTypeParameter & TYPE_PARAMETER_APP_PREFERS_ICON) != 0; } private int getBGColorFromCache(ActivityInfo ai, IntSupplier windowBgColorSupplier) { return mColorCache.getWindowColor(ai.packageName, mLastPackageContextConfigHash, mTmpAttrs.mWindowBgColor, mTmpAttrs.mWindowBgResId, windowBgColorSupplier).mBgColor; Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingWindowControllerTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class StartingWindowControllerTests extends ShellTestCase { MockitoAnnotations.initMocks(this); doReturn(mock(Display.class)).when(mDisplayManager).getDisplay(anyInt()); doReturn(mDisplayManager).when(mContext).getSystemService(eq(DisplayManager.class)); doReturn(super.mContext.getResources()).when(mContext).getResources(); mShellInit = spy(new ShellInit(mMainExecutor)); mShellController = spy(new ShellController(mContext, mShellInit, mShellCommandHandler, mMainExecutor)); Loading Loading
core/java/android/window/StartingWindowInfo.java +7 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,13 @@ public final class StartingWindowInfo implements Parcelable { */ public static final int TYPE_PARAMETER_WINDOWLESS = 0x00000100; /** * Application has set Window_windowSplashScreenBehavior to * SPLASH_SCREEN_BEHAVIOR_ICON_PREFERRED. * @hide */ public static final int TYPE_PARAMETER_APP_PREFERS_ICON = 0x00000200; /** * Application is allowed to use the legacy splash screen * @hide Loading
libs/WindowManager/Shell/res/values-television/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -57,4 +57,9 @@ - 0 for radial vanish + slide up - 1 for fade out --> <integer name="starting_window_exit_animation_type">1</integer> <!-- Whether this device allows to use the appIcon as a fallback icon for the splash screen window. If false, the splash screen will be a solid color splash screen whenever the app has not provided a windowSplashScreenAnimatedIcon. --> <bool name="config_canUseAppIconForSplashScreen">false</bool> </resources>
libs/WindowManager/Shell/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -136,4 +136,9 @@ <!-- Whether DragAndDrop capability is enabled --> <bool name="config_enableShellDragDrop">true</bool> <!-- Whether this device allows to use the appIcon as a fallback icon for the splash screen window. If false, the splash screen will be a solid color splash screen whenever the app has not provided a windowSplashScreenAnimatedIcon. --> <bool name="config_canUseAppIconForSplashScreen">true</bool> </resources>
libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenContentDrawer.java +14 −2 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.view.Display.DEFAULT_DISPLAY; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SPLASH_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_APP_PREFERS_ICON; import android.annotation.ColorInt; import android.annotation.IntDef; Loading Loading @@ -125,6 +126,7 @@ public class SplashscreenContentDrawer { private final TransactionPool mTransactionPool; private final SplashScreenWindowAttrs mTmpAttrs = new SplashScreenWindowAttrs(); private final Handler mSplashscreenWorkerHandler; private final boolean mCanUseAppIconForSplashScreen; @VisibleForTesting final ColorCache mColorCache; Loading @@ -141,6 +143,8 @@ public class SplashscreenContentDrawer { shellSplashscreenWorkerThread.start(); mSplashscreenWorkerHandler = shellSplashscreenWorkerThread.getThreadHandler(); mColorCache = new ColorCache(mContext, mSplashscreenWorkerHandler); mCanUseAppIconForSplashScreen = context.getResources().getBoolean( com.android.wm.shell.R.bool.config_canUseAppIconForSplashScreen); } /** Loading Loading @@ -427,7 +431,10 @@ public class SplashscreenContentDrawer { getWindowAttrs(context, mTmpAttrs); mLastPackageContextConfigHash = context.getResources().getConfiguration().hashCode(); final Drawable legacyDrawable = suggestType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN final @StartingWindowType int splashType = suggestType == STARTING_WINDOW_TYPE_SPLASH_SCREEN && !canUseIcon(info) ? STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN : suggestType; final Drawable legacyDrawable = splashType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN ? peekLegacySplashscreenContent(context, mTmpAttrs) : null; final ActivityInfo ai = info.targetActivityInfo != null ? info.targetActivityInfo Loading @@ -439,12 +446,17 @@ public class SplashscreenContentDrawer { return new SplashViewBuilder(context, ai) .setWindowBGColor(themeBGColor) .overlayDrawable(legacyDrawable) .chooseStyle(suggestType) .chooseStyle(splashType) .setUiThreadInitConsumer(uiThreadInitConsumer) .setAllowHandleSolidColor(info.allowHandleSolidColorSplashScreen()) .build(); } private boolean canUseIcon(StartingWindowInfo info) { return mCanUseAppIconForSplashScreen || mTmpAttrs.mSplashScreenIcon != null || (info.startingWindowTypeParameter & TYPE_PARAMETER_APP_PREFERS_ICON) != 0; } private int getBGColorFromCache(ActivityInfo ai, IntSupplier windowBgColorSupplier) { return mColorCache.getWindowColor(ai.packageName, mLastPackageContextConfigHash, mTmpAttrs.mWindowBgColor, mTmpAttrs.mWindowBgResId, windowBgColorSupplier).mBgColor; Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/startingsurface/StartingWindowControllerTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class StartingWindowControllerTests extends ShellTestCase { MockitoAnnotations.initMocks(this); doReturn(mock(Display.class)).when(mDisplayManager).getDisplay(anyInt()); doReturn(mDisplayManager).when(mContext).getSystemService(eq(DisplayManager.class)); doReturn(super.mContext.getResources()).when(mContext).getResources(); mShellInit = spy(new ShellInit(mMainExecutor)); mShellController = spy(new ShellController(mContext, mShellInit, mShellCommandHandler, mMainExecutor)); Loading