Merge "Rename 'EMPTY' to 'SOLID_COLOR' for splash screen style." into tm-dev

This commit is contained in:
Wei Sheng Shih
2022-03-03 01:30:43 +00:00
committed by Android (Google) Code Review
12 changed files with 70 additions and 69 deletions

View File

@@ -57912,8 +57912,8 @@ package android.window {
method public void clearOnExitAnimationListener(); method public void clearOnExitAnimationListener();
method public void setOnExitAnimationListener(@NonNull android.window.SplashScreen.OnExitAnimationListener); method public void setOnExitAnimationListener(@NonNull android.window.SplashScreen.OnExitAnimationListener);
method public void setSplashScreenTheme(@StyleRes int); method public void setSplashScreenTheme(@StyleRes int);
field public static final int SPLASH_SCREEN_STYLE_EMPTY = 0; // 0x0
field public static final int SPLASH_SCREEN_STYLE_ICON = 1; // 0x1 field public static final int SPLASH_SCREEN_STYLE_ICON = 1; // 0x1
field public static final int SPLASH_SCREEN_STYLE_SOLID_COLOR = 0; // 0x0
} }
public static interface SplashScreen.OnExitAnimationListener { public static interface SplashScreen.OnExitAnimationListener {

View File

@@ -1472,12 +1472,12 @@ public class ActivityOptions extends ComponentOptions {
* Sets the preferred splash screen style of the opening activities. This only applies if the * Sets the preferred splash screen style of the opening activities. This only applies if the
* Activity or Process is not yet created. * Activity or Process is not yet created.
* @param style Can be either {@link SplashScreen#SPLASH_SCREEN_STYLE_ICON} or * @param style Can be either {@link SplashScreen#SPLASH_SCREEN_STYLE_ICON} or
* {@link SplashScreen#SPLASH_SCREEN_STYLE_EMPTY} * {@link SplashScreen#SPLASH_SCREEN_STYLE_SOLID_COLOR}
*/ */
@NonNull @NonNull
public ActivityOptions setSplashScreenStyle(@SplashScreen.SplashScreenStyle int style) { public ActivityOptions setSplashScreenStyle(@SplashScreen.SplashScreenStyle int style) {
if (style == SplashScreen.SPLASH_SCREEN_STYLE_ICON if (style == SplashScreen.SPLASH_SCREEN_STYLE_ICON
|| style == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) { || style == SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR) {
mSplashScreenStyle = style; mSplashScreenStyle = style;
} }
return this; return this;

View File

@@ -52,7 +52,7 @@ public interface SplashScreen {
* Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to avoid showing the * Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to avoid showing the
* splash screen icon of the launched activity * splash screen icon of the launched activity
*/ */
int SPLASH_SCREEN_STYLE_EMPTY = 0; int SPLASH_SCREEN_STYLE_SOLID_COLOR = 0;
/** /**
* Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to show the splash screen * Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to show the splash screen
* icon of the launched activity. * icon of the launched activity.
@@ -62,7 +62,7 @@ public interface SplashScreen {
/** @hide */ /** @hide */
@IntDef(prefix = { "SPLASH_SCREEN_STYLE_" }, value = { @IntDef(prefix = { "SPLASH_SCREEN_STYLE_" }, value = {
SPLASH_SCREEN_STYLE_UNDEFINED, SPLASH_SCREEN_STYLE_UNDEFINED,
SPLASH_SCREEN_STYLE_EMPTY, SPLASH_SCREEN_STYLE_SOLID_COLOR,
SPLASH_SCREEN_STYLE_ICON SPLASH_SCREEN_STYLE_ICON
}) })
@interface SplashScreenStyle {} @interface SplashScreenStyle {}

View File

@@ -152,7 +152,7 @@ public final class SplashScreenView extends FrameLayout {
private Instant mIconAnimationStart; private Instant mIconAnimationStart;
private Duration mIconAnimationDuration; private Duration mIconAnimationDuration;
private Consumer<Runnable> mUiThreadInitTask; private Consumer<Runnable> mUiThreadInitTask;
private boolean mAllowHandleEmpty = true; private boolean mAllowHandleSolidColor = true;
public Builder(@NonNull Context context) { public Builder(@NonNull Context context) {
mContext = context; mContext = context;
@@ -263,8 +263,8 @@ public final class SplashScreenView extends FrameLayout {
* Sets whether this view can be copied and transferred to the client if the view is * Sets whether this view can be copied and transferred to the client if the view is
* empty style splash screen. * empty style splash screen.
*/ */
public Builder setAllowHandleEmpty(boolean allowHandleEmpty) { public Builder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
mAllowHandleEmpty = allowHandleEmpty; mAllowHandleSolidColor = allowHandleSolidColor;
return this; return this;
} }
@@ -314,7 +314,7 @@ public final class SplashScreenView extends FrameLayout {
} }
view.mIconView = imageView; view.mIconView = imageView;
} }
if (mOverlayDrawable != null || (view.mIconView == null && !mAllowHandleEmpty)) { if (mOverlayDrawable != null || (view.mIconView == null && !mAllowHandleSolidColor)) {
view.setNotCopyable(); view.setNotCopyable();
} }

View File

@@ -50,10 +50,10 @@ public final class StartingWindowInfo implements Parcelable {
*/ */
public static final int STARTING_WINDOW_TYPE_SNAPSHOT = 2; public static final int STARTING_WINDOW_TYPE_SNAPSHOT = 2;
/** /**
* Prefer empty splash screen starting window. * Prefer solid color splash screen starting window.
* @hide * @hide
*/ */
public static final int STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN = 3; public static final int STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN = 3;
/** @hide **/ /** @hide **/
public static final int STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN = 4; public static final int STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN = 4;
@@ -65,7 +65,7 @@ public final class StartingWindowInfo implements Parcelable {
STARTING_WINDOW_TYPE_NONE, STARTING_WINDOW_TYPE_NONE,
STARTING_WINDOW_TYPE_SPLASH_SCREEN, STARTING_WINDOW_TYPE_SPLASH_SCREEN,
STARTING_WINDOW_TYPE_SNAPSHOT, STARTING_WINDOW_TYPE_SNAPSHOT,
STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN, STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN,
STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
}) })
public @interface StartingWindowType {} public @interface StartingWindowType {}
@@ -115,8 +115,8 @@ public final class StartingWindowInfo implements Parcelable {
TYPE_PARAMETER_PROCESS_RUNNING, TYPE_PARAMETER_PROCESS_RUNNING,
TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT, TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT,
TYPE_PARAMETER_ACTIVITY_CREATED, TYPE_PARAMETER_ACTIVITY_CREATED,
TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN, TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN,
TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN, TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN,
TYPE_PARAMETER_LEGACY_SPLASH_SCREEN TYPE_PARAMETER_LEGACY_SPLASH_SCREEN
}) })
public @interface StartingTypeParams {} public @interface StartingTypeParams {}
@@ -135,17 +135,17 @@ public final class StartingWindowInfo implements Parcelable {
/** @hide */ /** @hide */
public static final int TYPE_PARAMETER_ACTIVITY_CREATED = 0x00000010; public static final int TYPE_PARAMETER_ACTIVITY_CREATED = 0x00000010;
/** @hide */ /** @hide */
public static final int TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN = 0x00000020; public static final int TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN = 0x00000020;
/** /**
* The parameter which indicates if the activity has finished drawing. * The parameter which indicates if the activity has finished drawing.
* @hide * @hide
*/ */
public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040; public static final int TYPE_PARAMETER_ACTIVITY_DRAWN = 0x00000040;
/** /**
* Application is allowed to handle empty splash screen. * Application is allowed to handle solid color splash screen.
* @hide * @hide
*/ */
public static final int TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN = 0x00000080; public static final int TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN = 0x00000080;
/** /**
* Application is allowed to use the legacy splash screen * Application is allowed to use the legacy splash screen
* @hide * @hide
@@ -192,10 +192,10 @@ public final class StartingWindowInfo implements Parcelable {
} }
/** /**
* Return whether the application allow to handle the empty style splash screen. * Return whether the application allow to handle the solid color style splash screen.
*/ */
public boolean allowHandleEmptySplashScreen() { public boolean allowHandleSolidColorSplashScreen() {
return (startingWindowTypeParameter & TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN) != 0; return (startingWindowTypeParameter & TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN) != 0;
} }
@Override @Override

View File

@@ -18,8 +18,8 @@ package com.android.wm.shell.startingsurface;
import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST; import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; 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.STARTING_WINDOW_TYPE_SPLASH_SCREEN;
import static com.android.wm.shell.startingsurface.StartingSurfaceDrawer.MAX_ANIMATION_DURATION; import static com.android.wm.shell.startingsurface.StartingSurfaceDrawer.MAX_ANIMATION_DURATION;
@@ -270,7 +270,7 @@ public class SplashscreenContentDrawer {
.overlayDrawable(legacyDrawable) .overlayDrawable(legacyDrawable)
.chooseStyle(suggestType) .chooseStyle(suggestType)
.setUiThreadInitConsumer(uiThreadInitConsumer) .setUiThreadInitConsumer(uiThreadInitConsumer)
.setAllowHandleEmpty(info.allowHandleEmptySplashScreen()) .setAllowHandleSolidColor(info.allowHandleSolidColorSplashScreen())
.build(); .build();
} }
@@ -367,7 +367,7 @@ public class SplashscreenContentDrawer {
private Drawable[] mFinalIconDrawables; private Drawable[] mFinalIconDrawables;
private int mFinalIconSize = mIconSize; private int mFinalIconSize = mIconSize;
private Consumer<Runnable> mUiThreadInitTask; private Consumer<Runnable> mUiThreadInitTask;
private boolean mAllowHandleEmpty; private boolean mAllowHandleSolidColor;
StartingWindowViewBuilder(@NonNull Context context, @NonNull ActivityInfo aInfo) { StartingWindowViewBuilder(@NonNull Context context, @NonNull ActivityInfo aInfo) {
mContext = context; mContext = context;
@@ -394,15 +394,15 @@ public class SplashscreenContentDrawer {
return this; return this;
} }
StartingWindowViewBuilder setAllowHandleEmpty(boolean allowHandleEmpty) { StartingWindowViewBuilder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
mAllowHandleEmpty = allowHandleEmpty; mAllowHandleSolidColor = allowHandleSolidColor;
return this; return this;
} }
SplashScreenView build() { SplashScreenView build() {
Drawable iconDrawable; Drawable iconDrawable;
final long animationDuration; final long animationDuration;
if (mSuggestType == STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN if (mSuggestType == STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN
|| mSuggestType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN) { || mSuggestType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN) {
// empty or legacy splash screen case // empty or legacy splash screen case
animationDuration = 0; animationDuration = 0;
@@ -538,7 +538,7 @@ public class SplashscreenContentDrawer {
.setCenterViewDrawable(foreground) .setCenterViewDrawable(foreground)
.setAnimationDurationMillis(animationDuration) .setAnimationDurationMillis(animationDuration)
.setUiThreadInitConsumer(uiThreadInitTask) .setUiThreadInitConsumer(uiThreadInitTask)
.setAllowHandleEmpty(mAllowHandleEmpty); .setAllowHandleSolidColor(mAllowHandleSolidColor);
if (mSuggestType == STARTING_WINDOW_TYPE_SPLASH_SCREEN if (mSuggestType == STARTING_WINDOW_TYPE_SPLASH_SCREEN
&& mTmpAttrs.mBrandingImage != null) { && mTmpAttrs.mBrandingImage != null) {

View File

@@ -16,10 +16,10 @@
package com.android.wm.shell.startingsurface; package com.android.wm.shell.startingsurface;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT;
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.STARTING_WINDOW_TYPE_SPLASH_SCREEN;
import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission; import static com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
@@ -155,7 +155,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo
private static boolean isSplashScreenType(@StartingWindowType int suggestionType) { private static boolean isSplashScreenType(@StartingWindowType int suggestionType) {
return suggestionType == STARTING_WINDOW_TYPE_SPLASH_SCREEN return suggestionType == STARTING_WINDOW_TYPE_SPLASH_SCREEN
|| suggestionType == STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN || suggestionType == STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN
|| suggestionType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; || suggestionType == STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN;
} }

View File

@@ -17,10 +17,10 @@
package com.android.wm.shell.startingsurface.phone; package com.android.wm.shell.startingsurface.phone;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_NONE;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SNAPSHOT;
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.STARTING_WINDOW_TYPE_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_CREATED; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_CREATED;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_DRAWN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_DRAWN;
@@ -29,7 +29,7 @@ import static android.window.StartingWindowInfo.TYPE_PARAMETER_LEGACY_SPLASH_SCR
import static android.window.StartingWindowInfo.TYPE_PARAMETER_NEW_TASK; import static android.window.StartingWindowInfo.TYPE_PARAMETER_NEW_TASK;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING; import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH; import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN;
import android.window.StartingWindowInfo; import android.window.StartingWindowInfo;
import android.window.TaskSnapshot; import android.window.TaskSnapshot;
@@ -51,8 +51,8 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
final boolean processRunning = (parameter & TYPE_PARAMETER_PROCESS_RUNNING) != 0; final boolean processRunning = (parameter & TYPE_PARAMETER_PROCESS_RUNNING) != 0;
final boolean allowTaskSnapshot = (parameter & TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT) != 0; final boolean allowTaskSnapshot = (parameter & TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT) != 0;
final boolean activityCreated = (parameter & TYPE_PARAMETER_ACTIVITY_CREATED) != 0; final boolean activityCreated = (parameter & TYPE_PARAMETER_ACTIVITY_CREATED) != 0;
final boolean useEmptySplashScreen = final boolean isSolidColorSplashScreen =
(parameter & TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN) != 0; (parameter & TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN) != 0;
final boolean legacySplashScreen = final boolean legacySplashScreen =
((parameter & TYPE_PARAMETER_LEGACY_SPLASH_SCREEN) != 0); ((parameter & TYPE_PARAMETER_LEGACY_SPLASH_SCREEN) != 0);
final boolean activityDrawn = (parameter & TYPE_PARAMETER_ACTIVITY_DRAWN) != 0; final boolean activityDrawn = (parameter & TYPE_PARAMETER_ACTIVITY_DRAWN) != 0;
@@ -65,16 +65,16 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
+ "processRunning=%b, " + "processRunning=%b, "
+ "allowTaskSnapshot=%b, " + "allowTaskSnapshot=%b, "
+ "activityCreated=%b, " + "activityCreated=%b, "
+ "useEmptySplashScreen=%b, " + "isSolidColorSplashScreen=%b, "
+ "legacySplashScreen=%b, " + "legacySplashScreen=%b, "
+ "activityDrawn=%b, " + "activityDrawn=%b, "
+ "topIsHome=%b", + "topIsHome=%b",
newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated, newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated,
useEmptySplashScreen, legacySplashScreen, activityDrawn, topIsHome); isSolidColorSplashScreen, legacySplashScreen, activityDrawn, topIsHome);
if (!topIsHome) { if (!topIsHome) {
if (!processRunning || newTask || (taskSwitch && !activityCreated)) { if (!processRunning || newTask || (taskSwitch && !activityCreated)) {
return getSplashscreenType(useEmptySplashScreen, legacySplashScreen); return getSplashscreenType(isSolidColorSplashScreen, legacySplashScreen);
} }
} }
@@ -84,19 +84,20 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
return STARTING_WINDOW_TYPE_SNAPSHOT; return STARTING_WINDOW_TYPE_SNAPSHOT;
} }
if (!topIsHome) { if (!topIsHome) {
return STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN; return STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN;
} }
} }
if (!activityDrawn && !topIsHome) { if (!activityDrawn && !topIsHome) {
return getSplashscreenType(useEmptySplashScreen, legacySplashScreen); return getSplashscreenType(isSolidColorSplashScreen, legacySplashScreen);
} }
} }
return STARTING_WINDOW_TYPE_NONE; return STARTING_WINDOW_TYPE_NONE;
} }
private static int getSplashscreenType(boolean emptySplashScreen, boolean legacySplashScreen) { private static int getSplashscreenType(boolean solidColorSplashScreen,
return emptySplashScreen boolean legacySplashScreen) {
? STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN return solidColorSplashScreen
? STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN
: legacySplashScreen : legacySplashScreen
? STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN ? STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
: STARTING_WINDOW_TYPE_SPLASH_SCREEN; : STARTING_WINDOW_TYPE_SPLASH_SCREEN;

View File

@@ -16,7 +16,7 @@
package com.android.wm.shell.startingsurface.tv; package com.android.wm.shell.startingsurface.tv;
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN;
import android.window.StartingWindowInfo; import android.window.StartingWindowInfo;
@@ -30,6 +30,6 @@ public class TvStartingWindowTypeAlgorithm implements StartingWindowTypeAlgorith
@Override @Override
public int getSuggestedWindowType(StartingWindowInfo windowInfo) { public int getSuggestedWindowType(StartingWindowInfo windowInfo) {
// For now we want to always show empty splash screens on TV. // For now we want to always show empty splash screens on TV.
return STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN; return STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN;
} }
} }

View File

@@ -543,7 +543,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
final RootWindowContainer mRootWindowContainer; final RootWindowContainer mRootWindowContainer;
// Tracking splash screen status from previous activity // Tracking splash screen status from previous activity
boolean mSplashScreenStyleEmpty = false; boolean mSplashScreenStyleSolidColor = false;
Drawable mEnterpriseThumbnailDrawable; Drawable mEnterpriseThumbnailDrawable;
@@ -826,7 +826,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
*/ */
private static final int SPLASH_SCREEN_BEHAVIOR_DEFAULT = 0; private static final int SPLASH_SCREEN_BEHAVIOR_DEFAULT = 0;
/** /**
* The icon is shown unless the launching app specified SPLASH_SCREEN_STYLE_EMPTY. * The icon is shown unless the launching app specified SPLASH_SCREEN_STYLE_SOLID_COLOR.
* *
* @see android.R.attr#windowSplashScreenBehavior * @see android.R.attr#windowSplashScreenBehavior
*/ */
@@ -2182,7 +2182,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
@VisibleForTesting @VisibleForTesting
boolean addStartingWindow(String pkg, int resolvedTheme, ActivityRecord from, boolean newTask, boolean addStartingWindow(String pkg, int resolvedTheme, ActivityRecord from, boolean newTask,
boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot, boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot,
boolean activityCreated, boolean useEmpty, boolean activityCreated, boolean isSimple,
boolean activityAllDrawn) { boolean activityAllDrawn) {
// If the display is frozen, we won't do anything until the actual window is // If the display is frozen, we won't do anything until the actual window is
// displayed so there is no reason to put in the starting window. // displayed so there is no reason to put in the starting window.
@@ -2218,7 +2218,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
final int typeParameter = StartingSurfaceController final int typeParameter = StartingSurfaceController
.makeStartingWindowTypeParameter(newTask, taskSwitch, processRunning, .makeStartingWindowTypeParameter(newTask, taskSwitch, processRunning,
allowTaskSnapshot, activityCreated, useEmpty, useLegacy, activityAllDrawn, allowTaskSnapshot, activityCreated, isSimple, useLegacy, activityAllDrawn,
type, packageName, mUserId); type, packageName, mUserId);
if (type == STARTING_WINDOW_TYPE_SNAPSHOT) { if (type == STARTING_WINDOW_TYPE_SNAPSHOT) {
@@ -6137,7 +6137,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
void onFirstWindowDrawn(WindowState win) { void onFirstWindowDrawn(WindowState win) {
firstWindowDrawn = true; firstWindowDrawn = true;
// stop tracking // stop tracking
mSplashScreenStyleEmpty = true; mSplashScreenStyleSolidColor = true;
// We now have a good window to show, remove dead placeholders // We now have a good window to show, remove dead placeholders
removeDeadWindows(); removeDeadWindows();
@@ -6172,7 +6172,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
void onStartingWindowDrawn() { void onStartingWindowDrawn() {
boolean wasTaskVisible = false; boolean wasTaskVisible = false;
if (task != null) { if (task != null) {
mSplashScreenStyleEmpty = true; mSplashScreenStyleSolidColor = true;
wasTaskVisible = task.getHasBeenVisible(); wasTaskVisible = task.getHasBeenVisible();
task.setHasBeenVisible(true); task.setHasBeenVisible(true);
} }
@@ -6646,10 +6646,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
} }
return false; return false;
} }
private boolean shouldUseEmptySplashScreen(ActivityRecord sourceRecord, boolean startActivity, private boolean shouldUseSolidColorSplashScreen(ActivityRecord sourceRecord,
ActivityOptions options, int resolvedTheme) { boolean startActivity, ActivityOptions options, int resolvedTheme) {
if (sourceRecord == null && !startActivity) { if (sourceRecord == null && !startActivity) {
// Use empty style if this activity is not top activity. This could happen when adding // Use simple style if this activity is not top activity. This could happen when adding
// a splash screen window to the warm start activity which is re-create because top is // a splash screen window to the warm start activity which is re-create because top is
// finishing. // finishing.
final ActivityRecord above = task.getActivityAbove(this); final ActivityRecord above = task.getActivityAbove(this);
@@ -6661,7 +6661,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// setSplashScreenStyle decide in priority of windowSplashScreenBehavior. // setSplashScreenStyle decide in priority of windowSplashScreenBehavior.
if (options != null) { if (options != null) {
final int optionsStyle = options.getSplashScreenStyle(); final int optionsStyle = options.getSplashScreenStyle();
if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) { if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR) {
return true; return true;
} else if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_ICON } else if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_ICON
|| isIconStylePreferred(resolvedTheme)) { || isIconStylePreferred(resolvedTheme)) {
@@ -6682,11 +6682,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
} }
if (sourceRecord != null && !sourceRecord.isActivityTypeHome()) { if (sourceRecord != null && !sourceRecord.isActivityTypeHome()) {
return sourceRecord.mSplashScreenStyleEmpty; return sourceRecord.mSplashScreenStyleSolidColor;
} }
// If this activity was launched from Launcher or System for first start, never use an // If this activity was launched from Launcher or System for first start, never use a
// empty splash screen. // solid color splash screen.
// Need to check sourceRecord before in case this activity is launched from service. // Need to check sourceRecord before in case this activity is launched from service.
return !startActivity || !(mLaunchSourceType == LAUNCH_SOURCE_TYPE_SYSTEM return !startActivity || !(mLaunchSourceType == LAUNCH_SOURCE_TYPE_SYSTEM
|| mLaunchSourceType == LAUNCH_SOURCE_TYPE_HOME); || mLaunchSourceType == LAUNCH_SOURCE_TYPE_HOME);
@@ -6752,7 +6752,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
final int resolvedTheme = evaluateStartingWindowTheme(prev, packageName, theme, final int resolvedTheme = evaluateStartingWindowTheme(prev, packageName, theme,
splashScreenTheme); splashScreenTheme);
mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(sourceRecord, startActivity, mSplashScreenStyleSolidColor = shouldUseSolidColorSplashScreen(sourceRecord, startActivity,
startOptions, resolvedTheme); startOptions, resolvedTheme);
final boolean activityCreated = final boolean activityCreated =
@@ -6764,7 +6764,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
final boolean scheduled = addStartingWindow(packageName, resolvedTheme, final boolean scheduled = addStartingWindow(packageName, resolvedTheme,
prev, newTask || newSingleActivity, taskSwitch, processRunning, prev, newTask || newSingleActivity, taskSwitch, processRunning,
allowTaskSnapshot(), activityCreated, mSplashScreenStyleEmpty, allDrawn); allowTaskSnapshot(), activityCreated, mSplashScreenStyleSolidColor, allDrawn);
if (DEBUG_STARTING_WINDOW_VERBOSE && scheduled) { if (DEBUG_STARTING_WINDOW_VERBOSE && scheduled) {
Slog.d(TAG, "Scheduled starting window for " + this); Slog.d(TAG, "Scheduled starting window for " + this);
} }

View File

@@ -18,13 +18,13 @@ package com.android.server.wm;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_CREATED; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_CREATED;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_DRAWN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ACTIVITY_DRAWN;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT; import static android.window.StartingWindowInfo.TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_LEGACY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_LEGACY_SPLASH_SCREEN;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_NEW_TASK; import static android.window.StartingWindowInfo.TYPE_PARAMETER_NEW_TASK;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING; import static android.window.StartingWindowInfo.TYPE_PARAMETER_PROCESS_RUNNING;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH; import static android.window.StartingWindowInfo.TYPE_PARAMETER_TASK_SWITCH;
import static android.window.StartingWindowInfo.TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN; import static android.window.StartingWindowInfo.TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN;
import static com.android.server.wm.ActivityRecord.STARTING_WINDOW_TYPE_SPLASH_SCREEN; import static com.android.server.wm.ActivityRecord.STARTING_WINDOW_TYPE_SPLASH_SCREEN;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -51,12 +51,12 @@ public class StartingSurfaceController {
private static final String TAG = TAG_WITH_CLASS_NAME private static final String TAG = TAG_WITH_CLASS_NAME
? StartingSurfaceController.class.getSimpleName() : TAG_WM; ? StartingSurfaceController.class.getSimpleName() : TAG_WM;
/** /**
* Allow the empty style splash screen view can be copy and transfer to another process if * Allow the solid color style splash screen view can be copy and transfer to another process if
* the app targeting to {@link android.os.Build.VERSION_CODES#TIRAMISU} or higher. * the app targeting to {@link android.os.Build.VERSION_CODES#TIRAMISU} or higher.
*/ */
@ChangeId @ChangeId
@EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU) @EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
private static final long ALLOW_COPY_EMPTY_VIEW = 205907456L; private static final long ALLOW_COPY_SOLID_COLOR_VIEW = 205907456L;
private final WindowManagerService mService; private final WindowManagerService mService;
private final SplashScreenExceptionList mSplashScreenExceptionsList; private final SplashScreenExceptionList mSplashScreenExceptionsList;
@@ -96,7 +96,7 @@ public class StartingSurfaceController {
static int makeStartingWindowTypeParameter(boolean newTask, boolean taskSwitch, static int makeStartingWindowTypeParameter(boolean newTask, boolean taskSwitch,
boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated, boolean processRunning, boolean allowTaskSnapshot, boolean activityCreated,
boolean useEmpty, boolean useLegacy, boolean activityDrawn, int startingWindowType, boolean isSolidColor, boolean useLegacy, boolean activityDrawn, int startingWindowType,
String packageName, int userId) { String packageName, int userId) {
int parameter = 0; int parameter = 0;
if (newTask) { if (newTask) {
@@ -114,8 +114,8 @@ public class StartingSurfaceController {
if (activityCreated) { if (activityCreated) {
parameter |= TYPE_PARAMETER_ACTIVITY_CREATED; parameter |= TYPE_PARAMETER_ACTIVITY_CREATED;
} }
if (useEmpty) { if (isSolidColor) {
parameter |= TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN; parameter |= TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN;
} }
if (useLegacy) { if (useLegacy) {
parameter |= TYPE_PARAMETER_LEGACY_SPLASH_SCREEN; parameter |= TYPE_PARAMETER_LEGACY_SPLASH_SCREEN;
@@ -124,9 +124,9 @@ public class StartingSurfaceController {
parameter |= TYPE_PARAMETER_ACTIVITY_DRAWN; parameter |= TYPE_PARAMETER_ACTIVITY_DRAWN;
} }
if (startingWindowType == STARTING_WINDOW_TYPE_SPLASH_SCREEN if (startingWindowType == STARTING_WINDOW_TYPE_SPLASH_SCREEN
&& CompatChanges.isChangeEnabled(ALLOW_COPY_EMPTY_VIEW, packageName, && CompatChanges.isChangeEnabled(ALLOW_COPY_SOLID_COLOR_VIEW, packageName,
UserHandle.of(userId))) { UserHandle.of(userId))) {
parameter |= TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN; parameter |= TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN;
} }
return parameter; return parameter;
} }

View File

@@ -2625,14 +2625,14 @@ public class ActivityRecordTests extends WindowTestsBase {
.setTask(sourceRecord.getTask()).build(); .setTask(sourceRecord.getTask()).build();
secondRecord.showStartingWindow(null /* prev */, true /* newTask */, false, secondRecord.showStartingWindow(null /* prev */, true /* newTask */, false,
true /* startActivity */, sourceRecord); true /* startActivity */, sourceRecord);
assertFalse(secondRecord.mSplashScreenStyleEmpty); assertFalse(secondRecord.mSplashScreenStyleSolidColor);
secondRecord.onStartingWindowDrawn(); secondRecord.onStartingWindowDrawn();
final ActivityRecord finalRecord = new ActivityBuilder(mAtm) final ActivityRecord finalRecord = new ActivityBuilder(mAtm)
.setTask(sourceRecord.getTask()).build(); .setTask(sourceRecord.getTask()).build();
finalRecord.showStartingWindow(null /* prev */, true /* newTask */, false, finalRecord.showStartingWindow(null /* prev */, true /* newTask */, false,
true /* startActivity */, secondRecord); true /* startActivity */, secondRecord);
assertTrue(finalRecord.mSplashScreenStyleEmpty); assertTrue(finalRecord.mSplashScreenStyleSolidColor);
} }
@Test @Test