DO NOT MERGE: Backport N backup/restore stability work to M am: d6f3a11107
am: aac7d0442c

Change-Id: Ida93e1782221df18b2e7abcaa9da319e5ed28325