summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2017-11-03 13:11:00 -0700
committer chaviw <chaviw@google.com> 2017-11-03 14:51:28 -0700
commit9ab4bd13bcd32cbe2f334cccce0a4d8cb22e14e7 (patch)
tree877181e5a5940862a0ae0839fc57e99ff6223ec2
parentbf09a05eb2be41a75f5b1a8681529c4c8dd89fbe (diff)
Remove layer from previous relative list.
If a layer is getting a new zOrderRelative, it needs to remove itself from its previous zOrderRelative's list, if it had one. Test: Open app that opens the ime. Switch to another app that opens the ime. Relative layers are updated properly. Change-Id: I54fbfc0f926d39a1630f3b2faed04fbf428b4fe3
-rwxr-xr-xservices/surfaceflinger/Layer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 5405971afa..0525607c35 100755
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1868,6 +1868,10 @@ bool Layer::setRelativeLayer(const sp<IBinder>& relativeToHandle, int32_t z) {
mCurrentState.modified = true;
mCurrentState.z = z;
+ auto oldZOrderRelativeOf = mCurrentState.zOrderRelativeOf.promote();
+ if (oldZOrderRelativeOf != nullptr) {
+ oldZOrderRelativeOf->removeZOrderRelative(this);
+ }
mCurrentState.zOrderRelativeOf = relative;
relative->addZOrderRelative(this);