From 7ab8929cc6ecbd1ba14c0d6ecb393b31f9a6fcda Mon Sep 17 00:00:00 2001 From: Andres Morales Date: Thu, 10 Jul 2014 16:10:43 -0700 Subject: [PATCH] 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 --- src/com/android/settings/MasterClearConfirm.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/settings/MasterClearConfirm.java b/src/com/android/settings/MasterClearConfirm.java index 4ee17b81002..2ba1e7fcc1e 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 @@ public class MasterClearConfirm extends Fragment { 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);