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

Commit 35d70d06 authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

Remove PointerIcon frame size checks for animated drawables

PointerIcons are already only loaded from system server's UiThread.
However, there are still some cases where system resources, such as
display density, change asynchronously from different threads.
It is difficult to synchronize resource updates and resource
loading.

After the introduction of Vector icons, the frame size of PointerIcons
will depend on the display density, so we must assume that the density
can change while loading icons. We should no longer enforce that all
frames of an animated icon are the same size. The rest of the pipeline
makes no assertions that all animation frames are the same size.

Bug: 362296003
Bug: 362462770
Test: Presubmit
Flag: EXEMPT bug fix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:14406149022cde05386523402c4edbc15ee00902)
Merged-In: If04ff8224e64c7efa57d10a5f149d52a7569ef9a
Change-Id: If04ff8224e64c7efa57d10a5f149d52a7569ef9a
parent f06da9bd
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -521,8 +521,6 @@ public final class PointerIcon implements Parcelable {
                // Assumes they have the exact duration.
                mDurationPerFrame = animationDrawable.getDuration(0);
                mBitmapFrames = new Bitmap[frames - 1];
                final int width = drawable.getIntrinsicWidth();
                final int height = drawable.getIntrinsicHeight();
                final boolean isVectorAnimation = drawable instanceof VectorDrawable;
                mDrawNativeDropShadow = isVectorAnimation;
                for (int i = 1; i < frames; ++i) {
@@ -537,12 +535,6 @@ public final class PointerIcon implements Parcelable {
                                + "is a different type from the others. All frames should be the "
                                + "same type.");
                    }
                    if (drawableFrame.getIntrinsicWidth() != width ||
                        drawableFrame.getIntrinsicHeight() != height) {
                        throw new IllegalArgumentException("The bitmap size of " + i + "-th frame "
                                + "is different. All frames should have the exact same size and "
                                + "share the same hotspot.");
                    }
                    if (isVectorAnimation) {
                        drawableFrame = getBitmapDrawableFromVectorDrawable(resources,
                                (VectorDrawable) drawableFrame, pointerScale);