diff options
| author | Wilson Wu <wilsonwu@google.com> | 2021-04-20 16:28:53 +0800 |
|---|---|---|
| committer | Wilson Wu <wilsonwu@google.com> | 2021-04-22 12:46:35 +0800 |
| commit | 08f5b9c846cd5f58229192e55eeefca7eb71be2f (patch) | |
| tree | 930701d168b7a156f2636720b751f73299255582 /core/java/android/view/InsetsSourceConsumer.java | |
| parent | f98e690f9e29738a95343fef20c1d31e50b4c6d4 (diff) | |
Prevent addtional removeSurface calls
The surface may not be cleared by its owner when
it lose control last time. We had CL[1] to clean
up the surface if we don't plan to show.
Add new checking condition for last control, so
once we have control we only remove the surface
if last control was null.
[1]: I4910c2a06cc67b0470477b245fc1de54b75f10f9
Bug: 185557884
Test: atest InsetsSourceConsumerTest
Change-Id: I1a4f05f9b4cf6fa121554ff0abc9fdc418b95276
Diffstat (limited to 'core/java/android/view/InsetsSourceConsumer.java')
| -rw-r--r-- | core/java/android/view/InsetsSourceConsumer.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/view/InsetsSourceConsumer.java b/core/java/android/view/InsetsSourceConsumer.java index 8e50fed7f392..f6df9f49d93f 100644 --- a/core/java/android/view/InsetsSourceConsumer.java +++ b/core/java/android/view/InsetsSourceConsumer.java @@ -179,7 +179,9 @@ public class InsetsSourceConsumer { if (oldLeash == null || newLeash == null || !oldLeash.isSameSurface(newLeash)) { applyHiddenToControl(); } - if (!requestedVisible && !mIsAnimationPending) { + + // Remove the surface that owned by last control when it lost. + if (!requestedVisible && !mIsAnimationPending && lastControl == null) { removeSurface(); } } |
