On factory reset, wipe the stored account challenges

Each time a user adds an account, a challenge gets
stored to the persistent data block service.

If a user factory resets *from Settings*, this is
considered a "secure wipe" and thus we must wipe
the account challenges as well.

No other factory reset mechanism must be permitted
to wipe this data.

Bug: 14288780
Change-Id: Ibe48ccae2d7b5f8d736717a27b7c4f44bed0fba7
This commit is contained in:
Andres Morales
2014-07-10 16:10:43 -07:00
parent d0a057ccc8
commit 7ab8929cc6

View File

@@ -16,6 +16,8 @@
package com.android.settings; package com.android.settings;
import android.content.Context;
import android.service.persistentdata.PersistentDataBlockManager;
import com.android.internal.os.storage.ExternalStorageFormatter; import com.android.internal.os.storage.ExternalStorageFormatter;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
@@ -59,6 +61,13 @@ public class MasterClearConfirm extends Fragment {
return; return;
} }
PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
if (pdbManager != null) {
pdbManager.wipe();
}
if (mEraseSdCard) { if (mEraseSdCard) {
Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET); Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET);
intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME); intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);