Improve first opaque activity candidate detection

To catch the right candidate as first opaque activity beneath
a translucent one and handle normal permission dialog
behaviour and smart links.

Fixes: 278661668
Test: Run `atest WmTests:SizeCompatTests`
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bcf680d064ea8921091bfc4620b6958adf79e8a2)
Merged-In: I62e829555c43136080ee4909f7dcf8c388165e9f
Change-Id: I62e829555c43136080ee4909f7dcf8c388165e9f
3 files changed