Ignore OverlayHandlerView as active child

Summary:
On foldable devices, there's an issue whereas the topmost root view is of type `OverlayHandlerView`.

This doesn't seem to be related in any way to the running app's UI. Or at least is not something of interest when debugging the running app's UI (for example, ig4a).

This change effectively ignores the `OverlayHandlerView` instance as active child and instead returns the next to last root view.

Reviewed By: LukeDefeo

Differential Revision: D44579223

fbshipit-source-id: cea52289c5ba1e6a96817232ac54725b8d2f48d9
This commit is contained in:
Lorenzo Blasa
2023-03-31 10:11:06 -07:00
committed by Facebook GitHub Bot
parent 5b0ae2a4f8
commit 8f9bf978e1

View File

@@ -18,7 +18,15 @@ object ApplicationRefDescriptor : ChainedDescriptor<ApplicationRef>() {
override fun onGetActiveChild(node: ApplicationRef): Any? {
val children = onGetChildren(node)
return if (children.isNotEmpty()) children.last() else null
if (children.isNotEmpty()) {
val last = children.last()
if (last.javaClass.simpleName.contains("OverlayHandlerView")) {
return children.getOrNull(children.size - 2)
}
return last
}
return null
}
override fun onGetBounds(node: ApplicationRef): Bounds = DisplayMetrics.getDisplayBounds()