summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2018-01-22 17:02:48 +0100
committerJorim Jaggi <jjaggi@google.com>2018-01-22 20:16:53 +0100
commit4ed2c9db82607064666e4a9d9bd94f0e740ddfbc (patch)
tree3e5deeede7133f17f3fbabc8c2ce0e30c386b57d /quickstep
parent599752ed811d9e0a0e5764f3eff62c033bd91948 (diff)
downloadandroid_packages_apps_Trebuchet-4ed2c9db82607064666e4a9d9bd94f0e740ddfbc.tar.gz
android_packages_apps_Trebuchet-4ed2c9db82607064666e4a9d9bd94f0e740ddfbc.tar.bz2
android_packages_apps_Trebuchet-4ed2c9db82607064666e4a9d9bd94f0e740ddfbc.zip
Make app-controlled animations more robust
- Sometimes the system decides to destroy our surface before we have finished animating. While this is a bug in the system, we need to protect ourselves against any crashes in this case by checking getNextFrameNumber() != -1 with the new SystemUI lib. - Apply position of animation target for multi-window open animation. Test: Open Drive multiple times, observe no crash Fixes: 72301120 Change-Id: I47520cea0d11cab109bf6190ea0cc828efc62275
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/libs/sysui_shared.jarbin102946 -> 103039 bytes
-rw-r--r--quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java14
2 files changed, 13 insertions, 1 deletions
diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar
index 18ddeee6d..85b40d031 100644
--- a/quickstep/libs/sysui_shared.jar
+++ b/quickstep/libs/sysui_shared.jar
Binary files differ
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
index dd05cfed1..05044ddd6 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManager.java
@@ -29,6 +29,7 @@ import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Bundle;
+import android.util.Log;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@@ -49,6 +50,7 @@ import com.android.systemui.shared.system.TransactionCompat;
*/
public class LauncherAppTransitionManager {
+ private static final String TAG = "LauncherTransition";
private static final int REFRESH_RATE_MS = 16;
private final DragLayer mDragLayer;
@@ -228,6 +230,13 @@ public class LauncherAppTransitionManager {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
+ final Surface surface = getSurface(mFloatingView);
+ final long frameNumber = surface != null ? getNextFrameNumber(surface) : -1;
+ if (frameNumber == -1) {
+ // Booo, not cool! Our surface got destroyed, so no reason to animate anything.
+ Log.w(TAG, "Failed to animate, surface got destroyed.");
+ return;
+ }
final float percent = animation.getAnimatedFraction();
final float easePercent = Interpolators.AGGRESSIVE_EASE.getInterpolation(percent);
@@ -273,9 +282,12 @@ public class LauncherAppTransitionManager {
for (RemoteAnimationTargetCompat target : targets) {
if (target.mode == RemoteAnimationTargetCompat.MODE_OPENING) {
t.setAlpha(target.leash, alpha);
+
+ // TODO: This isn't correct at the beginning of the animation, but better
+ // than nothing.
+ matrix.postTranslate(target.position.x, target.position.y);
t.setMatrix(target.leash, matrix);
t.setWindowCrop(target.leash, crop);
- Surface surface = getSurface(mFloatingView);
t.deferTransactionUntil(target.leash, surface, getNextFrameNumber(surface));
}
if (isFirstFrame) {