Fix issues with state save/restore

 Bug: 5144214
 Tracked down the issue with messed up state to a bug where
 tab ids were not unique, and would actually get messed up in restore.
 Switched it to the tab's responsibility to assign an id to itself
 in the ctor to make sure all possible paths where a tab is created
 are fixed as well as the tab being the best informed about whether
 or not it has an ID to restore from. Added some checks to watch for
 a similar problem in the future as well.

Change-Id: Icd8333232a0baca7a3639323538886ea595de05a
3 files changed