Rename 'EMPTY' to 'SOLID_COLOR' for splash screen style.
Preventing from misleading developers. Bug: 217953215 Test: atest SplashscreenTests StartingSurfaceDrawerTests ActivityRecordTests Change-Id: I8669effb2e843ebe61e807850359b07b36b39fb3
This commit is contained in:
@@ -57912,8 +57912,8 @@ package android.window {
|
||||
method public void clearOnExitAnimationListener();
|
||||
method public void setOnExitAnimationListener(@NonNull android.window.SplashScreen.OnExitAnimationListener);
|
||||
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_SOLID_COLOR = 0; // 0x0
|
||||
}
|
||||
|
||||
public static interface SplashScreen.OnExitAnimationListener {
|
||||
|
||||
@@ -1472,12 +1472,12 @@ public class ActivityOptions extends ComponentOptions {
|
||||
* Sets the preferred splash screen style of the opening activities. This only applies if the
|
||||
* Activity or Process is not yet created.
|
||||
* @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
|
||||
public ActivityOptions setSplashScreenStyle(@SplashScreen.SplashScreenStyle int style) {
|
||||
if (style == SplashScreen.SPLASH_SCREEN_STYLE_ICON
|
||||
|| style == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) {
|
||||
|| style == SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR) {
|
||||
mSplashScreenStyle = style;
|
||||
}
|
||||
return this;
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface SplashScreen {
|
||||
* Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to avoid showing the
|
||||
* 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
|
||||
* icon of the launched activity.
|
||||
@@ -62,7 +62,7 @@ public interface SplashScreen {
|
||||
/** @hide */
|
||||
@IntDef(prefix = { "SPLASH_SCREEN_STYLE_" }, value = {
|
||||
SPLASH_SCREEN_STYLE_UNDEFINED,
|
||||
SPLASH_SCREEN_STYLE_EMPTY,
|
||||
SPLASH_SCREEN_STYLE_SOLID_COLOR,
|
||||
SPLASH_SCREEN_STYLE_ICON
|
||||
})
|
||||
@interface SplashScreenStyle {}
|
||||
|
||||
@@ -152,7 +152,7 @@ public final class SplashScreenView extends FrameLayout {
|
||||
private Instant mIconAnimationStart;
|
||||
private Duration mIconAnimationDuration;
|
||||
private Consumer<Runnable> mUiThreadInitTask;
|
||||
private boolean mAllowHandleEmpty = true;
|
||||
private boolean mAllowHandleSolidColor = true;
|
||||
|
||||
public Builder(@NonNull Context 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
|
||||
* empty style splash screen.
|
||||
*/
|
||||
public Builder setAllowHandleEmpty(boolean allowHandleEmpty) {
|
||||
mAllowHandleEmpty = allowHandleEmpty;
|
||||
public Builder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
|
||||
mAllowHandleSolidColor = allowHandleSolidColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public final class SplashScreenView extends FrameLayout {
|
||||
}
|
||||
view.mIconView = imageView;
|
||||
}
|
||||
if (mOverlayDrawable != null || (view.mIconView == null && !mAllowHandleEmpty)) {
|
||||
if (mOverlayDrawable != null || (view.mIconView == null && !mAllowHandleSolidColor)) {
|
||||
view.setNotCopyable();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
*/
|
||||
public static final int STARTING_WINDOW_TYPE_SNAPSHOT = 2;
|
||||
/**
|
||||
* Prefer empty splash screen starting window.
|
||||
* Prefer solid color splash screen starting window.
|
||||
* @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 **/
|
||||
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_SPLASH_SCREEN,
|
||||
STARTING_WINDOW_TYPE_SNAPSHOT,
|
||||
STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN,
|
||||
STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN,
|
||||
STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
|
||||
})
|
||||
public @interface StartingWindowType {}
|
||||
@@ -115,8 +115,8 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
TYPE_PARAMETER_PROCESS_RUNNING,
|
||||
TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT,
|
||||
TYPE_PARAMETER_ACTIVITY_CREATED,
|
||||
TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN,
|
||||
TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN,
|
||||
TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN,
|
||||
TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN,
|
||||
TYPE_PARAMETER_LEGACY_SPLASH_SCREEN
|
||||
})
|
||||
public @interface StartingTypeParams {}
|
||||
@@ -135,17 +135,17 @@ public final class StartingWindowInfo implements Parcelable {
|
||||
/** @hide */
|
||||
public static final int TYPE_PARAMETER_ACTIVITY_CREATED = 0x00000010;
|
||||
/** @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.
|
||||
* @hide
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
* @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() {
|
||||
return (startingWindowTypeParameter & TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN) != 0;
|
||||
public boolean allowHandleSolidColorSplashScreen() {
|
||||
return (startingWindowTypeParameter & TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,8 @@ package com.android.wm.shell.startingsurface;
|
||||
|
||||
import static android.os.Process.THREAD_PRIORITY_TOP_APP_BOOST;
|
||||
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_SOLID_COLOR_SPLASH_SCREEN;
|
||||
import static android.window.StartingWindowInfo.STARTING_WINDOW_TYPE_SPLASH_SCREEN;
|
||||
|
||||
import static com.android.wm.shell.startingsurface.StartingSurfaceDrawer.MAX_ANIMATION_DURATION;
|
||||
@@ -270,7 +270,7 @@ public class SplashscreenContentDrawer {
|
||||
.overlayDrawable(legacyDrawable)
|
||||
.chooseStyle(suggestType)
|
||||
.setUiThreadInitConsumer(uiThreadInitConsumer)
|
||||
.setAllowHandleEmpty(info.allowHandleEmptySplashScreen())
|
||||
.setAllowHandleSolidColor(info.allowHandleSolidColorSplashScreen())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ public class SplashscreenContentDrawer {
|
||||
private Drawable[] mFinalIconDrawables;
|
||||
private int mFinalIconSize = mIconSize;
|
||||
private Consumer<Runnable> mUiThreadInitTask;
|
||||
private boolean mAllowHandleEmpty;
|
||||
private boolean mAllowHandleSolidColor;
|
||||
|
||||
StartingWindowViewBuilder(@NonNull Context context, @NonNull ActivityInfo aInfo) {
|
||||
mContext = context;
|
||||
@@ -394,15 +394,15 @@ public class SplashscreenContentDrawer {
|
||||
return this;
|
||||
}
|
||||
|
||||
StartingWindowViewBuilder setAllowHandleEmpty(boolean allowHandleEmpty) {
|
||||
mAllowHandleEmpty = allowHandleEmpty;
|
||||
StartingWindowViewBuilder setAllowHandleSolidColor(boolean allowHandleSolidColor) {
|
||||
mAllowHandleSolidColor = allowHandleSolidColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
SplashScreenView build() {
|
||||
Drawable iconDrawable;
|
||||
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) {
|
||||
// empty or legacy splash screen case
|
||||
animationDuration = 0;
|
||||
@@ -538,7 +538,7 @@ public class SplashscreenContentDrawer {
|
||||
.setCenterViewDrawable(foreground)
|
||||
.setAnimationDurationMillis(animationDuration)
|
||||
.setUiThreadInitConsumer(uiThreadInitTask)
|
||||
.setAllowHandleEmpty(mAllowHandleEmpty);
|
||||
.setAllowHandleSolidColor(mAllowHandleSolidColor);
|
||||
|
||||
if (mSuggestType == STARTING_WINDOW_TYPE_SPLASH_SCREEN
|
||||
&& mTmpAttrs.mBrandingImage != null) {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
package com.android.wm.shell.startingsurface;
|
||||
|
||||
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_NONE;
|
||||
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 com.android.wm.shell.common.ExecutorUtils.executeRemoteCallWithTaskPermission;
|
||||
@@ -155,7 +155,7 @@ public class StartingWindowController implements RemoteCallable<StartingWindowCo
|
||||
|
||||
private static boolean isSplashScreenType(@StartingWindowType int suggestionType) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package com.android.wm.shell.startingsurface.phone;
|
||||
|
||||
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_NONE;
|
||||
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.TYPE_PARAMETER_ACTIVITY_CREATED;
|
||||
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_PROCESS_RUNNING;
|
||||
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.TaskSnapshot;
|
||||
@@ -51,8 +51,8 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
|
||||
final boolean processRunning = (parameter & TYPE_PARAMETER_PROCESS_RUNNING) != 0;
|
||||
final boolean allowTaskSnapshot = (parameter & TYPE_PARAMETER_ALLOW_TASK_SNAPSHOT) != 0;
|
||||
final boolean activityCreated = (parameter & TYPE_PARAMETER_ACTIVITY_CREATED) != 0;
|
||||
final boolean useEmptySplashScreen =
|
||||
(parameter & TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN) != 0;
|
||||
final boolean isSolidColorSplashScreen =
|
||||
(parameter & TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN) != 0;
|
||||
final boolean legacySplashScreen =
|
||||
((parameter & TYPE_PARAMETER_LEGACY_SPLASH_SCREEN) != 0);
|
||||
final boolean activityDrawn = (parameter & TYPE_PARAMETER_ACTIVITY_DRAWN) != 0;
|
||||
@@ -65,16 +65,16 @@ public class PhoneStartingWindowTypeAlgorithm implements StartingWindowTypeAlgor
|
||||
+ "processRunning=%b, "
|
||||
+ "allowTaskSnapshot=%b, "
|
||||
+ "activityCreated=%b, "
|
||||
+ "useEmptySplashScreen=%b, "
|
||||
+ "isSolidColorSplashScreen=%b, "
|
||||
+ "legacySplashScreen=%b, "
|
||||
+ "activityDrawn=%b, "
|
||||
+ "topIsHome=%b",
|
||||
newTask, taskSwitch, processRunning, allowTaskSnapshot, activityCreated,
|
||||
useEmptySplashScreen, legacySplashScreen, activityDrawn, topIsHome);
|
||||
isSolidColorSplashScreen, legacySplashScreen, activityDrawn, topIsHome);
|
||||
|
||||
if (!topIsHome) {
|
||||
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;
|
||||
}
|
||||
if (!topIsHome) {
|
||||
return STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN;
|
||||
return STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN;
|
||||
}
|
||||
}
|
||||
if (!activityDrawn && !topIsHome) {
|
||||
return getSplashscreenType(useEmptySplashScreen, legacySplashScreen);
|
||||
return getSplashscreenType(isSolidColorSplashScreen, legacySplashScreen);
|
||||
}
|
||||
}
|
||||
return STARTING_WINDOW_TYPE_NONE;
|
||||
}
|
||||
|
||||
private static int getSplashscreenType(boolean emptySplashScreen, boolean legacySplashScreen) {
|
||||
return emptySplashScreen
|
||||
? STARTING_WINDOW_TYPE_EMPTY_SPLASH_SCREEN
|
||||
private static int getSplashscreenType(boolean solidColorSplashScreen,
|
||||
boolean legacySplashScreen) {
|
||||
return solidColorSplashScreen
|
||||
? STARTING_WINDOW_TYPE_SOLID_COLOR_SPLASH_SCREEN
|
||||
: legacySplashScreen
|
||||
? STARTING_WINDOW_TYPE_LEGACY_SPLASH_SCREEN
|
||||
: STARTING_WINDOW_TYPE_SPLASH_SCREEN;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@@ -30,6 +30,6 @@ public class TvStartingWindowTypeAlgorithm implements StartingWindowTypeAlgorith
|
||||
@Override
|
||||
public int getSuggestedWindowType(StartingWindowInfo windowInfo) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +543,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
final RootWindowContainer mRootWindowContainer;
|
||||
|
||||
// Tracking splash screen status from previous activity
|
||||
boolean mSplashScreenStyleEmpty = false;
|
||||
boolean mSplashScreenStyleSolidColor = false;
|
||||
|
||||
Drawable mEnterpriseThumbnailDrawable;
|
||||
|
||||
@@ -826,7 +826,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -2182,7 +2182,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
@VisibleForTesting
|
||||
boolean addStartingWindow(String pkg, int resolvedTheme, ActivityRecord from, boolean newTask,
|
||||
boolean taskSwitch, boolean processRunning, boolean allowTaskSnapshot,
|
||||
boolean activityCreated, boolean useEmpty,
|
||||
boolean activityCreated, boolean isSimple,
|
||||
boolean activityAllDrawn) {
|
||||
// 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.
|
||||
@@ -2218,7 +2218,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|
||||
final int typeParameter = StartingSurfaceController
|
||||
.makeStartingWindowTypeParameter(newTask, taskSwitch, processRunning,
|
||||
allowTaskSnapshot, activityCreated, useEmpty, useLegacy, activityAllDrawn,
|
||||
allowTaskSnapshot, activityCreated, isSimple, useLegacy, activityAllDrawn,
|
||||
type, packageName, mUserId);
|
||||
|
||||
if (type == STARTING_WINDOW_TYPE_SNAPSHOT) {
|
||||
@@ -6137,7 +6137,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
void onFirstWindowDrawn(WindowState win) {
|
||||
firstWindowDrawn = true;
|
||||
// stop tracking
|
||||
mSplashScreenStyleEmpty = true;
|
||||
mSplashScreenStyleSolidColor = true;
|
||||
|
||||
// We now have a good window to show, remove dead placeholders
|
||||
removeDeadWindows();
|
||||
@@ -6172,7 +6172,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
void onStartingWindowDrawn() {
|
||||
boolean wasTaskVisible = false;
|
||||
if (task != null) {
|
||||
mSplashScreenStyleEmpty = true;
|
||||
mSplashScreenStyleSolidColor = true;
|
||||
wasTaskVisible = task.getHasBeenVisible();
|
||||
task.setHasBeenVisible(true);
|
||||
}
|
||||
@@ -6646,10 +6646,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean shouldUseEmptySplashScreen(ActivityRecord sourceRecord, boolean startActivity,
|
||||
ActivityOptions options, int resolvedTheme) {
|
||||
private boolean shouldUseSolidColorSplashScreen(ActivityRecord sourceRecord,
|
||||
boolean startActivity, ActivityOptions options, int resolvedTheme) {
|
||||
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
|
||||
// finishing.
|
||||
final ActivityRecord above = task.getActivityAbove(this);
|
||||
@@ -6661,7 +6661,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
// setSplashScreenStyle decide in priority of windowSplashScreenBehavior.
|
||||
if (options != null) {
|
||||
final int optionsStyle = options.getSplashScreenStyle();
|
||||
if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) {
|
||||
if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR) {
|
||||
return true;
|
||||
} else if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_ICON
|
||||
|| isIconStylePreferred(resolvedTheme)) {
|
||||
@@ -6682,11 +6682,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
}
|
||||
|
||||
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
|
||||
// empty splash screen.
|
||||
// If this activity was launched from Launcher or System for first start, never use a
|
||||
// solid color splash screen.
|
||||
// Need to check sourceRecord before in case this activity is launched from service.
|
||||
return !startActivity || !(mLaunchSourceType == LAUNCH_SOURCE_TYPE_SYSTEM
|
||||
|| mLaunchSourceType == LAUNCH_SOURCE_TYPE_HOME);
|
||||
@@ -6752,7 +6752,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
final int resolvedTheme = evaluateStartingWindowTheme(prev, packageName, theme,
|
||||
splashScreenTheme);
|
||||
|
||||
mSplashScreenStyleEmpty = shouldUseEmptySplashScreen(sourceRecord, startActivity,
|
||||
mSplashScreenStyleSolidColor = shouldUseSolidColorSplashScreen(sourceRecord, startActivity,
|
||||
startOptions, resolvedTheme);
|
||||
|
||||
final boolean activityCreated =
|
||||
@@ -6764,7 +6764,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|
||||
final boolean scheduled = addStartingWindow(packageName, resolvedTheme,
|
||||
prev, newTask || newSingleActivity, taskSwitch, processRunning,
|
||||
allowTaskSnapshot(), activityCreated, mSplashScreenStyleEmpty, allDrawn);
|
||||
allowTaskSnapshot(), activityCreated, mSplashScreenStyleSolidColor, allDrawn);
|
||||
if (DEBUG_STARTING_WINDOW_VERBOSE && scheduled) {
|
||||
Slog.d(TAG, "Scheduled starting window for " + this);
|
||||
}
|
||||
|
||||
@@ -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_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_LEGACY_SPLASH_SCREEN;
|
||||
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_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.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
@@ -51,12 +51,12 @@ public class StartingSurfaceController {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME
|
||||
? 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.
|
||||
*/
|
||||
@ChangeId
|
||||
@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 SplashScreenExceptionList mSplashScreenExceptionsList;
|
||||
@@ -96,7 +96,7 @@ public class StartingSurfaceController {
|
||||
|
||||
static int makeStartingWindowTypeParameter(boolean newTask, boolean taskSwitch,
|
||||
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) {
|
||||
int parameter = 0;
|
||||
if (newTask) {
|
||||
@@ -114,8 +114,8 @@ public class StartingSurfaceController {
|
||||
if (activityCreated) {
|
||||
parameter |= TYPE_PARAMETER_ACTIVITY_CREATED;
|
||||
}
|
||||
if (useEmpty) {
|
||||
parameter |= TYPE_PARAMETER_USE_EMPTY_SPLASH_SCREEN;
|
||||
if (isSolidColor) {
|
||||
parameter |= TYPE_PARAMETER_USE_SOLID_COLOR_SPLASH_SCREEN;
|
||||
}
|
||||
if (useLegacy) {
|
||||
parameter |= TYPE_PARAMETER_LEGACY_SPLASH_SCREEN;
|
||||
@@ -124,9 +124,9 @@ public class StartingSurfaceController {
|
||||
parameter |= TYPE_PARAMETER_ACTIVITY_DRAWN;
|
||||
}
|
||||
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))) {
|
||||
parameter |= TYPE_PARAMETER_ALLOW_HANDLE_EMPTY_SCREEN;
|
||||
parameter |= TYPE_PARAMETER_ALLOW_HANDLE_SOLID_COLOR_SCREEN;
|
||||
}
|
||||
return parameter;
|
||||
}
|
||||
|
||||
@@ -2625,14 +2625,14 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
.setTask(sourceRecord.getTask()).build();
|
||||
secondRecord.showStartingWindow(null /* prev */, true /* newTask */, false,
|
||||
true /* startActivity */, sourceRecord);
|
||||
assertFalse(secondRecord.mSplashScreenStyleEmpty);
|
||||
assertFalse(secondRecord.mSplashScreenStyleSolidColor);
|
||||
secondRecord.onStartingWindowDrawn();
|
||||
|
||||
final ActivityRecord finalRecord = new ActivityBuilder(mAtm)
|
||||
.setTask(sourceRecord.getTask()).build();
|
||||
finalRecord.showStartingWindow(null /* prev */, true /* newTask */, false,
|
||||
true /* startActivity */, secondRecord);
|
||||
assertTrue(finalRecord.mSplashScreenStyleEmpty);
|
||||
assertTrue(finalRecord.mSplashScreenStyleSolidColor);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user