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

Commit d4c5ab8b authored by Doris Liu's avatar Doris Liu
Browse files

Associate RenderNodes created for hw bitmap w/ views

In transition animations, in order to capture the content of a view
or a drawable in a hw bitmap, a RenderNode needs to be created. The
RenderNode was previously setup with no owning view. As a result,
in cases where RenderNode animations are triggered by the draw calls
in displaylist recording, these animations would fail for lack of a
view to animate on.

This CL ensures that when RenderNodes are created for the purpose of
populating content in a hw bitmap in transitions, there's always a
view associated with each RenderNode.

BUG: 65160121
Test: Force to repro crash by changing press state during hw bitmap
creation, which triggers a ripple animation that led to the
otherwise timing dependent and hard to repro crash.

Change-Id: I2b4ba95cad25a94d50b3904e775606f737e960e3
parent 73e6ff19
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public abstract class SharedElementCallback {
            Drawable d = imageView.getDrawable();
            Drawable bg = imageView.getBackground();
            if (d != null && (bg == null || bg.getAlpha() == 0)) {
                Bitmap bitmap = TransitionUtils.createDrawableBitmap(d);
                Bitmap bitmap = TransitionUtils.createDrawableBitmap(d, imageView);
                if (bitmap != null) {
                    Bundle bundle = new Bundle();
                    if (bitmap.getConfig() != Bitmap.Config.HARDWARE) {
+3 −3
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public class TransitionUtils {
    /**
     * Get a copy of bitmap of given drawable, return null if intrinsic size is zero
     */
    public static Bitmap createDrawableBitmap(Drawable drawable) {
    public static Bitmap createDrawableBitmap(Drawable drawable, View hostView) {
        int width = drawable.getIntrinsicWidth();
        int height = drawable.getIntrinsicHeight();
        if (width <= 0 || height <= 0) {
@@ -128,7 +128,7 @@ public class TransitionUtils {
        }
        int bitmapWidth = (int) (width * scale);
        int bitmapHeight = (int) (height * scale);
        final RenderNode node = RenderNode.create("TransitionUtils", null);
        final RenderNode node = RenderNode.create("TransitionUtils", hostView);
        node.setLeftTopRightBottom(0, 0, width, height);
        node.setClipToBounds(false);
        final DisplayListCanvas canvas = node.start(width, height);
@@ -169,7 +169,7 @@ public class TransitionUtils {
            matrix.postTranslate(-bounds.left, -bounds.top);
            matrix.postScale(scale, scale);

            final RenderNode node = RenderNode.create("TransitionUtils", null);
            final RenderNode node = RenderNode.create("TransitionUtils", view);
            node.setLeftTopRightBottom(0, 0, bitmapWidth, bitmapHeight);
            node.setClipToBounds(false);
            final DisplayListCanvas canvas = node.start(bitmapWidth, bitmapHeight);