From b62381359204689cc1f66169a9c9785ad15f8357 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Thu, 18 Jun 2020 18:27:01 -0700 Subject: [PATCH] Start dim animations on pending vs sync transaction We try to put animations on pending transaction to avoid jank. In this case, it also avoids bad state (where a surface is created/parented after its used for animation and potentially cleaned-up). Bug: 159336447 Test: enter split primary, in recents, take a screenshot and choose share, then expand the primary to leave split. Observe no lingering dim layer. Change-Id: Ia1301a3b22c6eb07192c99b2bfd9aa60ed3c7e95 --- services/core/java/com/android/server/wm/DisplayArea.java | 2 +- services/core/java/com/android/server/wm/Task.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java index b2fab9ae98c5d..8260cb31acda0 100644 --- a/services/core/java/com/android/server/wm/DisplayArea.java +++ b/services/core/java/com/android/server/wm/DisplayArea.java @@ -290,7 +290,7 @@ public class DisplayArea extends WindowContainer { mDimmer.resetDimStates(); } - if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) { + if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) { scheduleAnimation(); } } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 3acc5ee5ca3f4..fec484935d681 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -3507,7 +3507,7 @@ class Task extends WindowContainer { updateShadowsRadius(isFocused(), getSyncTransaction()); - if (mDimmer.updateDims(getSyncTransaction(), mTmpDimBoundsRect)) { + if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) { scheduleAnimation(); } }