As I read the code with my limited understanding, indirect fire (grenades, splash damage from rockets, blasters, etc.) should not trigger this. However, if you fire a rocket and it hits the target directly, at least then it get triggered. This is why in some cases (and with some specific sniper/spotter mods), you may want to target a ground square rather than enemy unit with your indirect fire.
I suppose apparently also a melee attack doesn't trigger this (if the unit was facing another way and didn't react and notice you visually). This was a somewhat surprising find for me.