Commit 48a0c2b8 authored by David Trainor's avatar David Trainor Committed by Commit Bot

Force anim Handler to be created for the UI thread

Somehow Animatable2.AnimationCallback#onAnimationEnd is being called on
a background thread.  This then tries to hit the compat version of
LazyInstanceCompat#AutoRestartCompat to reduce code duplication and
restart the animation.  In this case we're building the
AutoRestartCompat here, which has a local Handler variable that gets
created.  This causes a crash because Looper#prepare() wasn't called for
this thread.

I'm not quite sure why this is being called on the background, but we
definitely should be creating the Handler for the main looper.  Fixing
that here.

Adding NOTRY due to mac_chromium_rel_ng failure which is delaying this Android/Java only patch that needs to land for 71.  All other try bots are passing without issue.

BUG=905256
NOTRY=true

Change-Id: I523dc9a2cb06a0d26d1acdba3106c93aa272cfd3
Reviewed-on: https://chromium-review.googlesource.com/c/1351894
Commit-Queue: David Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611197}
parent 53001b7c
...@@ -14,6 +14,7 @@ import android.graphics.drawable.RotateDrawable; ...@@ -14,6 +14,7 @@ import android.graphics.drawable.RotateDrawable;
import android.graphics.drawable.ScaleDrawable; import android.graphics.drawable.ScaleDrawable;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.graphics.drawable.Animatable2Compat; import android.support.graphics.drawable.Animatable2Compat;
import android.support.v7.graphics.drawable.DrawableWrapper; import android.support.v7.graphics.drawable.DrawableWrapper;
...@@ -150,7 +151,7 @@ public class AutoAnimatorDrawable extends DrawableWrapper { ...@@ -150,7 +151,7 @@ public class AutoAnimatorDrawable extends DrawableWrapper {
} }
private static final class AutoRestarterCompat extends Animatable2Compat.AnimationCallback { private static final class AutoRestarterCompat extends Animatable2Compat.AnimationCallback {
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler(Looper.getMainLooper());
// Animatable2Compat.AnimationCallback implementation. // Animatable2Compat.AnimationCallback implementation.
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment