DO NOT MERGE: Backport N backup/restore stability work to M am: d6f3a11107 am: aac7d0442c am: 6ea7b630c2  -s ours
am: 5eac1c2544

Change-Id: I2e18c58c476c63535962c294c6a63716e536310b