Fix issue #5461497: Landed on Welcome screen after a tap on 'Next' in Screen 500

The basic problem was that at some points during setup wizard, this would
happen:

1. The app's process is killed.
2. The app's process is restarted, but not to actually resume the
   setup wizard activity, just to put it in the stopped state.
   When doing this, the saved state is cleared but the app will
   never provide a new one.
3. The app's process is killed again.  At this point, because the
   saved state is cleared, the activity is completely removed.
4. Eventually the entire activity stack becomes empty, and a new
   setup wizard activity needs to be created as the home app.

There is a combination of bad stuff going on here.

First, why is the process being killed?  At this point the setup
wizard is the home app, so it shouldn't be killed.  There were two
reasons why this was happening:

- CryptKeeper still was not completely cleanly going away.  To fix
  this, I removed the check in the activity manager to not allow
  an activity to finish if it is the only activity on the stack and
  maybe-kindof looks like the home app.  This really wasn't necessary
  (we always take care of starting a new home activity if we find the
  stack is empty), and outright dangerous with all of these things
  purporting to be home but not.

- There was an issue in computing the oom_adj where the home app
  would not be marked as "not hidden", and if we had to re-compute
  its oom adj in the current sequence would then give it an
  adjustment as a background process...  and with all the processes
  we spin through during boot, it quickly got down to background
  #16 and killed.

Second, what is going on with the state?  This is easier, the code
in the activity manager to create a new activity but put it in the
stopped state was still clearing the saved state.  The saved state
should only be cleared when going in to the resumed state.  When
going in to the stopped state, we can just keep holding the same
saved state.

Change-Id: I7d21cdcfa082d98ca70c79d9923e29605ee4353e
2 files changed