* commit '15c7f90c8d84ce992659d0ec29bb0e60f1b603d1': Method to wipe all adoptable disks.
This commit is contained in:
@@ -34,6 +34,7 @@ import android.os.ServiceManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.internal.os.SomeArgs;
|
||||
@@ -638,6 +639,30 @@ public class StorageManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public void wipeAdoptableDisks() {
|
||||
// We only wipe devices in "adoptable" locations, which are in a
|
||||
// long-term stable slot/location on the device, where apps have a
|
||||
// reasonable chance of storing sensitive data. (Apps need to go through
|
||||
// SAF to write to transient volumes.)
|
||||
final List<DiskInfo> disks = getDisks();
|
||||
for (DiskInfo disk : disks) {
|
||||
final String diskId = disk.getId();
|
||||
if (disk.isAdoptable()) {
|
||||
Slog.d(TAG, "Found adoptable " + diskId + "; wiping");
|
||||
try {
|
||||
// TODO: switch to explicit wipe command when we have it,
|
||||
// for now rely on the fact that vfat format does a wipe
|
||||
mMountService.partitionPublic(diskId);
|
||||
} catch (Exception e) {
|
||||
Slog.w(TAG, "Failed to wipe " + diskId + ", but soldiering onward", e);
|
||||
}
|
||||
} else {
|
||||
Slog.d(TAG, "Ignorning non-adoptable disk " + disk.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public void setVolumeNickname(String fsUuid, String nickname) {
|
||||
try {
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.android.internal.util.Preconditions;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Notes for a storage volume which may not be currently present.
|
||||
* Metadata for a storage volume which may not be currently present.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user