Fixes for modality/always-on-top issues (#1738 and others)

Change-Id: I4a10bb8019437839d8b44214fb74ef29f51dc6fc