summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityOptions.java28
-rw-r--r--core/java/android/window/SplashScreen.java19
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java9
3 files changed, 56 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 306b54d14019..1ce598b5fa18 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -56,6 +56,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.window.IRemoteTransition;
+import android.window.SplashScreen;
import android.window.WindowContainerToken;
import java.lang.annotation.Retention;
@@ -327,6 +328,10 @@ public class ActivityOptions {
private static final String KEY_LAUNCHED_FROM_BUBBLE =
"android.activity.launchTypeBubble";
+ /** See {@link #setSplashscreenStyle(int)}. */
+ private static final String KEY_SPLASH_SCREEN_STYLE =
+ "android.activity.splashScreenStyle";
+
/** See {@link #setTransientLaunch()}. */
private static final String KEY_TRANSIENT_LAUNCH = "android.activity.transientLaunch";
@@ -415,6 +420,8 @@ public class ActivityOptions {
private IRemoteTransition mRemoteTransition;
private boolean mOverrideTaskTransition;
private int mSplashScreenThemeResId;
+ @SplashScreen.SplashScreenStyle
+ private int mSplashScreenStyle;
private boolean mRemoveWithTaskOrganizer;
private boolean mLaunchedFromBubble;
private boolean mTransientLaunch;
@@ -1171,6 +1178,7 @@ public class ActivityOptions {
mRemoveWithTaskOrganizer = opts.getBoolean(KEY_REMOVE_WITH_TASK_ORGANIZER);
mLaunchedFromBubble = opts.getBoolean(KEY_LAUNCHED_FROM_BUBBLE);
mTransientLaunch = opts.getBoolean(KEY_TRANSIENT_LAUNCH);
+ mSplashScreenStyle = opts.getInt(KEY_SPLASH_SCREEN_STYLE);
}
/**
@@ -1365,6 +1373,23 @@ public class ActivityOptions {
}
/**
+ * Sets the preferred splash screen style.
+ * @hide
+ */
+ public void setSplashscreenStyle(@SplashScreen.SplashScreenStyle int style) {
+ mSplashScreenStyle = style;
+ }
+
+ /**
+ * Gets the preferred splash screen style from caller
+ * @hide
+ */
+ @SplashScreen.SplashScreenStyle
+ public int getSplashScreenStyle() {
+ return mSplashScreenStyle;
+ }
+
+ /**
* Sets whether the activity is to be launched into LockTask mode.
*
* Use this option to start an activity in LockTask mode. Note that only apps permitted by
@@ -1932,6 +1957,9 @@ public class ActivityOptions {
if (mTransientLaunch) {
b.putBoolean(KEY_TRANSIENT_LAUNCH, mTransientLaunch);
}
+ if (mSplashScreenStyle != 0) {
+ b.putInt(KEY_SPLASH_SCREEN_STYLE, mSplashScreenStyle);
+ }
return b;
}
diff --git a/core/java/android/window/SplashScreen.java b/core/java/android/window/SplashScreen.java
index 42a58fb65e39..3e0075857402 100644
--- a/core/java/android/window/SplashScreen.java
+++ b/core/java/android/window/SplashScreen.java
@@ -16,6 +16,7 @@
package android.window;
+import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.StyleRes;
import android.annotation.SuppressLint;
@@ -42,6 +43,24 @@ import java.util.ArrayList;
*/
public interface SplashScreen {
/**
+ * Force splash screen to be empty.
+ * @hide
+ */
+ int SPLASH_SCREEN_STYLE_EMPTY = 0;
+ /**
+ * Force splash screen to show icon.
+ * @hide
+ */
+ int SPLASH_SCREEN_STYLE_ICON = 1;
+
+ /** @hide */
+ @IntDef(prefix = { "SPLASH_SCREEN_STYLE_" }, value = {
+ SPLASH_SCREEN_STYLE_EMPTY,
+ SPLASH_SCREEN_STYLE_ICON
+ })
+ @interface SplashScreenStyle {}
+
+ /**
* <p>Specifies whether an {@link Activity} wants to handle the splash screen animation on its
* own. Normally the splash screen will show on screen before the content of the activity has
* been drawn, and disappear when the activity is showing on the screen. With this listener set,
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 9c43dd394124..660cd37b123c 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -308,6 +308,7 @@ import android.view.WindowManager.TransitionOldType;
import android.view.animation.Animation;
import android.window.IRemoteTransition;
import android.window.SizeConfigurationBuckets;
+import android.window.SplashScreen;
import android.window.SplashScreenView.SplashScreenViewParcelable;
import android.window.TaskSnapshot;
import android.window.WindowContainerToken;
@@ -6182,6 +6183,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
private boolean shouldUseEmptySplashScreen(ActivityRecord sourceRecord) {
+ if (mPendingOptions != null) {
+ final int optionsStyle = mPendingOptions.getSplashScreenStyle();
+ if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_EMPTY) {
+ return true;
+ } else if (optionsStyle == SplashScreen.SPLASH_SCREEN_STYLE_ICON) {
+ return false;
+ }
+ }
if (sourceRecord == null) {
sourceRecord = searchCandidateLaunchingActivity();
}