Maintain Z order for all layers in offscreen hierarchy
There was already code in place to ensure that z order was maintained in
the offscreen tree. However, this didn't work if a layer was moved to become
a child of an offscreen layer. The z order was only maintained beneath
the new offscreen layer, not the entire subtree.
This change uses the root of the offscreen subtree to ensure the z order
is maintained even when new offscreen layers are added to the subtree.
Fixes: 157188227
Test: IME gets correct relative z
Test: RelativeZTest.LayerWithRelativeReparentedToOffscreen
Change-Id: I62553ce245dacd2a8684d8bb02de67f60ddc6774
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 3fa935f..8507331 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -1088,6 +1088,10 @@
// Find the root of the cloned hierarchy, this means the first non cloned parent.
// This will return null if first non cloned parent is not found.
sp<Layer> getClonedRoot();
+
+ // Finds the top most layer in the hierarchy. This will find the root Layer where the parent is
+ // null.
+ sp<Layer> getRootLayer();
};
} // namespace android