Reset mAppTransitionAnimationSpecs so they are only used once

Because we didn't reset it after sending it to window manager,
they were used again in the next transition, leading to a
wrong animation.

Also fix a bug where we waited forever because
getAppTransitionAnimationSpecs returned null.

Bug: 25583739
Change-Id: Ifcccf2d3cee649f66b4ded1d92c059acfa02ba5b
This commit is contained in:
Jorim Jaggi
2015-11-09 14:33:20 +01:00
parent 7af8ea8a7c
commit 29deb334cd

View File

@@ -79,6 +79,13 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
private static final boolean DEBUG = false;
private static final boolean ADD_HEADER_BITMAP = true;
/**
* Special value for {@link #mAppTransitionAnimationSpecs}: Indicate that we are currently
* waiting for the specs to be retrieved.
*/
private static final List<AppTransitionAnimationSpec> SPECS_WAITING = new ArrayList<>();
private int mStackViewVisibility = View.VISIBLE;
/** The RecentsView callbacks */
@@ -109,7 +116,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
@GuardedBy("this")
List<AppTransitionAnimationSpec> mAppTransitionAnimationSpecs;
List<AppTransitionAnimationSpec> mAppTransitionAnimationSpecs = SPECS_WAITING;
public RecentsView(Context context) {
super(context);
@@ -439,7 +446,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
}
});
synchronized (RecentsView.this) {
while (mAppTransitionAnimationSpecs == null) {
while (mAppTransitionAnimationSpecs == SPECS_WAITING) {
try {
RecentsView.this.wait();
} catch (InterruptedException e) {}
@@ -449,7 +456,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
}
AppTransitionAnimationSpec[] specs
= new AppTransitionAnimationSpec[mAppTransitionAnimationSpecs.size()];
return mAppTransitionAnimationSpecs.toArray(specs);
mAppTransitionAnimationSpecs.toArray(specs);
mAppTransitionAnimationSpecs = SPECS_WAITING;
return specs;
}
}
};