SurfaceFlinger: Detect Rel Z loops

Telemetry indicates we are sometimes seeing crashes
due to infinite recursion in isHiddenByPolicy. We detect this
condition (relative Z loop) and add a helpful log. The performance
impact should be minimal as relative Z is rare, and
the traversal isn't doing any heavy work or sp<> promotion.

Bug: 213420016
Bug: 195298154
Bug: 219774897
Test: Existing tests pass
Change-Id: Ia11854654e99288c5846fe7c62ebabf37daeb139
2 files changed