Merge "Skip operation on content overlay if task's vanished" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5cac66cb4e
@@ -1384,11 +1384,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
|
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
|
||||||
animator.setDuration(mCrossFadeAnimationDuration);
|
animator.setDuration(mCrossFadeAnimationDuration);
|
||||||
animator.addUpdateListener(animation -> {
|
animator.addUpdateListener(animation -> {
|
||||||
|
if (mState == State.UNDEFINED) {
|
||||||
|
// Could happen if onTaskVanished happens during the animation since we may have
|
||||||
|
// set a start delay on this animation.
|
||||||
|
Log.d(TAG, "Task vanished, skip fadeOutAndRemoveOverlay");
|
||||||
|
animation.removeAllListeners();
|
||||||
|
animation.removeAllUpdateListeners();
|
||||||
|
animation.cancel();
|
||||||
|
} else {
|
||||||
final float alpha = (float) animation.getAnimatedValue();
|
final float alpha = (float) animation.getAnimatedValue();
|
||||||
final SurfaceControl.Transaction transaction =
|
final SurfaceControl.Transaction transaction =
|
||||||
mSurfaceControlTransactionFactory.getTransaction();
|
mSurfaceControlTransactionFactory.getTransaction();
|
||||||
transaction.setAlpha(surface, alpha);
|
transaction.setAlpha(surface, alpha);
|
||||||
transaction.apply();
|
transaction.apply();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
animator.addListener(new AnimatorListenerAdapter() {
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1401,6 +1410,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeContentOverlay(SurfaceControl surface, Runnable callback) {
|
private void removeContentOverlay(SurfaceControl surface, Runnable callback) {
|
||||||
|
if (mState == State.UNDEFINED) {
|
||||||
|
// Avoid double removal, which is fatal.
|
||||||
|
return;
|
||||||
|
}
|
||||||
final SurfaceControl.Transaction tx =
|
final SurfaceControl.Transaction tx =
|
||||||
mSurfaceControlTransactionFactory.getTransaction();
|
mSurfaceControlTransactionFactory.getTransaction();
|
||||||
tx.remove(surface);
|
tx.remove(surface);
|
||||||
|
|||||||
Reference in New Issue
Block a user