Prevent extra sessions owned by staged install from living across restarts

If system server crashes due to external reasons (not due to
exception in pre-reboot verifications), then the staged install will be
retried. But, any extra sessions that have not been cleaned up will
linger on until removed due to old age.

And if the crash keeps on happening every time at the worst possible
time, then we can have 1024 extra sessions created all with copies of
apks in it. It will waste a lot of user's space.

With this CL, we cleanup any leftover extra sessions whenever system
server is restarted.

Bug: 170784748
Test: manual
Test: verified that without this CL if system server crashses after
extra sessions are created but before they are cleaned up, then folders
start to pile up in /data/app folder with copy of the apks inside.

Change-Id: I5c19093853e28c668f882d37691959b1ac2464cc
Merged-In: I5c19093853e28c668f882d37691959b1ac2464cc
1 file changed