Fix index when moving SecurityFooter

When moving the security footer in the same container, correct the index if
it's before the desired position (because it will be removed from the
current position).

Also, extract moving logic so it can be easily tested.

Fixes: 195104944
Test: atest QSPanelTest QSPanelSwitchToParentTest
Change-Id: Ibc85cd5501010fcf9752d8af103500479c6f28c2
Merged-In: Ibc85cd5501010fcf9752d8af103500479c6f28c2
3 files changed