diff options
| author | Vadim Caen <caen@google.com> | 2021-06-09 19:28:38 +0200 |
|---|---|---|
| committer | wilsonshih <wilsonshih@google.com> | 2021-07-01 15:05:06 +0800 |
| commit | f08dae31587a342b64057340ea6b27e61c48a7e5 (patch) | |
| tree | 77fac8a956edc8620a09233813ab99b94d24c970 /core/java/android/window/SplashScreenView.java | |
| parent | 7c8167b0f2fad708b89e1010753fb8b17175ea99 (diff) | |
Implement the legacy splash screen behavior
For apps opted out of the new splash screen, we show the full background
drawable.
Ensure there has send the splash screen background color to
StartingWindowListener.
Bug: 182880656
Test: manual set useLegacy to true then verify legacy splash screen.
Test: atest WmTests:ActivityRecordTests
Test: atest StartingSurfaceDrawerTests
Change-Id: Icf662f3c5f368f447e718f82f78dc25b909ca9be
Diffstat (limited to 'core/java/android/window/SplashScreenView.java')
| -rw-r--r-- | core/java/android/window/SplashScreenView.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/window/SplashScreenView.java b/core/java/android/window/SplashScreenView.java index 148986a558e7..1efd2e381289 100644 --- a/core/java/android/window/SplashScreenView.java +++ b/core/java/android/window/SplashScreenView.java @@ -133,6 +133,8 @@ public final class SplashScreenView extends FrameLayout { private @ColorInt int mIconBackground; private Bitmap mParceledIconBitmap; private Drawable mIconDrawable; + // It is only set for legacy splash screen which won't be sent across processes. + private Drawable mOverlayDrawable; private SurfaceControlViewHost.SurfacePackage mSurfacePackage; private RemoteCallback mClientCallback; private int mBrandingImageWidth; @@ -193,6 +195,14 @@ public final class SplashScreenView extends FrameLayout { } /** + * Set the Drawable object to fill entire view + */ + public Builder setOverlayDrawable(@Nullable Drawable drawable) { + mOverlayDrawable = drawable; + return this; + } + + /** * Set the Drawable object to fill the center view. */ public Builder setCenterViewDrawable(@Nullable Drawable drawable) { @@ -236,7 +246,11 @@ public final class SplashScreenView extends FrameLayout { layoutInflater.inflate(R.layout.splash_screen_view, null, false); view.mInitBackgroundColor = mBackgroundColor; view.mInitIconBackgroundColor = mIconBackground; - view.setBackgroundColor(mBackgroundColor); + if (mOverlayDrawable != null) { + view.setBackground(mOverlayDrawable); + } else { + view.setBackgroundColor(mBackgroundColor); + } view.mClientCallback = mClientCallback; view.mBrandingImageView = view.findViewById(R.id.splashscreen_branding_view); @@ -261,6 +275,9 @@ public final class SplashScreenView extends FrameLayout { } } } + if (mOverlayDrawable != null || mIconDrawable == null) { + view.setNotCopyable(); + } if (mParceledIconBitmap != null) { view.mParceledIconBitmap = mParceledIconBitmap; |
