Better saving of state between app quit and restart.

Change-Id: I16907b42f7c28571dccd916353fb2e27c07a7d2c