Merge "Revert "Detect factory reset and deleteAllKeys"" into sc-dev