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

Commit 82cf9d7a authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Public API set and get splashscreen style"

parents 2a18ba18 bf666289
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4469,6 +4469,7 @@ package android.app {
    method public android.app.ActivityOptions setLaunchDisplayId(int);
    method public android.app.ActivityOptions setLockTaskEnabled(boolean);
    method public void setPendingIntentBackgroundActivityLaunchAllowed(boolean);
    method @NonNull public android.app.ActivityOptions setSplashScreenStyle(int);
    method public android.os.Bundle toBundle();
    method public void update(android.app.ActivityOptions);
    field public static final String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
@@ -57677,6 +57678,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
  }
  public static interface SplashScreen.OnExitAnimationListener {
+16 −9
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ public class ActivityOptions extends ComponentOptions {
    private static final String KEY_LAUNCHED_FROM_BUBBLE =
            "android.activity.launchTypeBubble";

    /** See {@link #setSplashscreenStyle(int)}. */
    /** See {@link #setSplashScreenStyle(int)}. */
    private static final String KEY_SPLASH_SCREEN_STYLE =
            "android.activity.splashScreenStyle";

@@ -1393,20 +1393,27 @@ public class ActivityOptions extends ComponentOptions {
    }

    /**
     * Sets the preferred splash screen style.
     * Gets the style can be used for cold-launching an activity.
     * @see #setSplashScreenStyle(int)
     * @hide
     */
    public void setSplashscreenStyle(@SplashScreen.SplashScreenStyle int style) {
        mSplashScreenStyle = style;
    public @SplashScreen.SplashScreenStyle int getSplashScreenStyle() {
        return mSplashScreenStyle;
    }

    /**
     * Gets the preferred splash screen style from caller
     * @hide
     * 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}
     */
    @SplashScreen.SplashScreenStyle
    public int getSplashScreenStyle() {
        return mSplashScreenStyle;
    @NonNull
    public ActivityOptions setSplashScreenStyle(@SplashScreen.SplashScreenStyle int style) {
        if (style == SplashScreen.SPLASH_SCREEN_STYLE_ICON
                || style == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) {
            mSplashScreenStyle = style;
        }
        return this;
    }

    /**
+5 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.StyleRes;
import android.annotation.SuppressLint;
import android.annotation.UiThread;
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.content.Context;
@@ -48,13 +49,13 @@ public interface SplashScreen {
     */
    int SPLASH_SCREEN_STYLE_UNDEFINED = -1;
    /**
     * Force splash screen to be empty.
     * @hide
     * 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;
    /**
     * Force splash screen to show icon.
     * @hide
     * Flag to be used with {@link ActivityOptions#setSplashScreenStyle}, to show the splash screen
     * icon of the launched activity.
     */
    int SPLASH_SCREEN_STYLE_ICON = 1;