Don't show separate option for erasing USB storage

On devices with emulated USB storage or SD card, factory reset will wipe
all data from that area. Given that, it doesn't make sense to show a
different option for wiping USB storage.

Bug: 3242568
Change-Id: I257bdde06141f14381c8c09ce6a42c18d7080efd
This commit is contained in:
Kenny Root
2011-01-18 15:14:32 -08:00
parent 0ad922f0ce
commit 3785e390d2
4 changed files with 33 additions and 10 deletions

View File

@@ -29,6 +29,7 @@ import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Environment;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.util.Log;
@@ -133,13 +134,29 @@ public class MasterClear extends Fragment {
mExternalStorageContainer = mContentView.findViewById(R.id.erase_external_container);
mExternalStorage = (CheckBox) mContentView.findViewById(R.id.erase_external);
mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
/*
* If the external storage is emulated, it will be erased with a factory
* reset at any rate. There is no need to have a separate option until
* we have a factory reset that only erases some directories and not
* others.
*/
if (Environment.isExternalStorageEmulated()) {
mExternalStorageContainer.setVisibility(View.GONE);
@Override
public void onClick(View v) {
mExternalStorage.toggle();
}
});
final View externalOption = mContentView.findViewById(R.id.erase_external_option_text);
externalOption.setVisibility(View.GONE);
final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external);
externalAlsoErased.setVisibility(View.VISIBLE);
} else {
mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mExternalStorage.toggle();
}
});
}
loadAccountList();
}