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