From 7b02804d9f39140ee28669efecdeeea687197bb8 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 5 May 2020 18:18:40 -0700 Subject: [PATCH] Add logs to debug playtime crash and band aid fix for release builds. Bug: 153821199 Change-Id: I0caa546254bb51ca8b88cdb16d79c054560bf2be (cherry picked from commit e620872b18c8ab24a32e35c1617be486b8a20556) --- .../android/launcher3/LauncherAnimationRunner.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java index 4ff0a72d2e..d16fda1be2 100644 --- a/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java +++ b/quickstep/src/com/android/launcher3/LauncherAnimationRunner.java @@ -26,6 +26,7 @@ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.os.Handler; +import android.util.Log; import androidx.annotation.BinderThread; import androidx.annotation.UiThread; @@ -37,6 +38,8 @@ import com.android.systemui.shared.system.RemoteAnimationTargetCompat; public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCompat, WrappedAnimationRunnerImpl { + private static final String TAG = "LauncherAnimationRunner"; + private final Handler mHandler; private final boolean mStartAtFrontOfQueue; private AnimationResult mAnimationResult; @@ -151,7 +154,16 @@ public abstract class LauncherAnimationRunner implements RemoteAnimationRunnerCo // Because t=0 has the app icon in its original spot, we can skip the // first frame and have the same movement one frame earlier. - mAnimator.setCurrentPlayTime(getSingleFrameMs(context)); + int singleFrameMs = getSingleFrameMs(context); + long playTime = singleFrameMs; + // b/153821199 Add logs to debug crash but ensure release builds do not crash. + if (Utilities.IS_DEBUG_DEVICE) { + Log.e(TAG, "Total duration=[" + mAnimator.getTotalDuration() + + "], singleFrameMs=[" + singleFrameMs + "], mAnimator=" + mAnimator); + } else { + playTime = Math.min(singleFrameMs, mAnimator.getTotalDuration()); + } + mAnimator.setCurrentPlayTime(playTime); } } }