Checkpoint staged session when state changes.

Bug: 118865310
Test: verified install_sessions.xml gets written and broadcast is
received by a small app I ran to receive updates. Tampered
install_sessions.xml manually to create invalid sessions, and verified
that they are correctly invalidated and re-written.

Change-Id: I026e82a2bb0bd829109946dd87b0add15336e1e3
3 files changed