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

Commit 566c4335 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Copy branding image drawable even while the view is Gone.

Once a View has set to invisible or gone, the copied size of the
background drawable would be empty. In order to copy a image from it,
specify the size while create the canvas. The visibility state will be
decide by client process.

Flag: EXEMPT bugfix
Bug: 395201920
Test: atest SplashscreenTests
Change-Id: I0900f14dfbfb6b9c8760c40920e4efc01cfd31ce
parent 05e684c4
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -733,11 +733,12 @@ public final class SplashScreenView extends FrameLayout {
                mIconBitmap = iconView != null
                        ? copyDrawable(((ImageView) view.getIconView()).getDrawable()) : null;
            }
            mBrandingBitmap = copyDrawable(view.getBrandingView().getBackground());

            ViewGroup.LayoutParams params = view.getBrandingView().getLayoutParams();
            final ViewGroup.LayoutParams params = view.getBrandingView().getLayoutParams();
            mBrandingWidth = params.width;
            mBrandingHeight = params.height;
            mBrandingBitmap = copyDrawableWithSize(view.getBrandingView().getBackground(),
                    mBrandingWidth, mBrandingHeight);

            if (view.getIconAnimationStart() != null) {
                mIconAnimationStartMillis = view.getIconAnimationStart().toEpochMilli();
@@ -752,6 +753,13 @@ public final class SplashScreenView extends FrameLayout {
                final Rect initialBounds = drawable.copyBounds();
                final int width = initialBounds.width();
                final int height = initialBounds.height();
                return copyDrawableWithSize(drawable, width, height);
            }
            return null;
        }

        private Bitmap copyDrawableWithSize(Drawable drawable, int width, int height) {
            if (drawable != null) {
                if (width <= 0 || height <= 0) {
                    return null;
                }