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
diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java
index 4ee17b8..2ba1e7f 100644
--- a/src/com/android/settings/MasterClearConfirm.java
+++ b/src/com/android/settings/MasterClearConfirm.java
@@ -16,6 +16,8 @@
 
 package com.android.settings;
 
+import android.content.Context;
+import android.service.persistentdata.PersistentDataBlockManager;
 import com.android.internal.os.storage.ExternalStorageFormatter;
 import com.android.internal.widget.LockPatternUtils;
 
@@ -59,6 +61,13 @@
                 return;
             }
 
+            PersistentDataBlockManager pdbManager = (PersistentDataBlockManager)
+                    getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
+
+            if (pdbManager != null) {
+                pdbManager.wipe();
+            }
+
             if (mEraseSdCard) {
                 Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET);
                 intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);