Fix crash while animating removed stack

Bug: 135711060
Test: atest PinnedStackTests
Change-Id: Ie1f3acb9d2152435dc018360ad5120f1ee678d3c
This commit is contained in:
Winson Chung
2019-06-24 11:57:22 -07:00
parent cff24b878d
commit 8312b1d2c1

View File

@@ -1936,8 +1936,12 @@ public class TaskStack extends WindowContainer<Task> implements
public boolean setPinnedStackAlpha(float alpha) {
// Hold the lock since this is called from the BoundsAnimator running on the UiThread
synchronized (mWmService.mGlobalLock) {
getPendingTransaction().setAlpha(getSurfaceControl(),
mCancelCurrentBoundsAnimation ? 1 : alpha);
final SurfaceControl sc = getSurfaceControl();
if (sc == null || !sc.isValid()) {
// If the stack is already removed, don't bother updating any stack animation
return false;
}
getPendingTransaction().setAlpha(sc, mCancelCurrentBoundsAnimation ? 1 : alpha);
scheduleAnimation();
return !mCancelCurrentBoundsAnimation;
}