Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db6ba3ba authored by wilsonshih's avatar wilsonshih
Browse files

Rename 'EMPTY' to 'SOLID_COLOR' for splash screen style.

Preventing from misleading developers.

Bug: 217953215
Test: atest SplashscreenTests StartingSurfaceDrawerTests
ActivityRecordTests

Change-Id: I8669effb2e843ebe61e807850359b07b36b39fb3
parent 47821c98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+2 −2
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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 {}
+4 −4
Original line number Diff line number Diff line
@@ -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();
            }

+11 −11
Original line number Diff line number Diff line
@@ -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
Loading