summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/MasterClear.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-10-14 11:58:30 -0700
committerDianne Hackborn <hackbod@google.com>2010-10-16 16:27:25 -0700
commit1337d0f70b18dd732c6a617be83e5be0bb8f2f87 (patch)
treee3e6e1eef5667cdbbc02a47948913a784eadc27a /src/com/android/settings/MasterClear.java
parent3594b1b73d022d5815bcdef78e6143cfd63ee354 (diff)
downloadpackages_apps_Settings-1337d0f70b18dd732c6a617be83e5be0bb8f2f87.zip
packages_apps_Settings-1337d0f70b18dd732c6a617be83e5be0bb8f2f87.tar.gz
packages_apps_Settings-1337d0f70b18dd732c6a617be83e5be0bb8f2f87.tar.bz2
Implement issue #3094621 and #3094609 - wipe sd card
3094621: add "wipe sd card" option to factory data reset 3094609: collapse unmount/format into one command Implements requested UI changes. Also some final tweaks to Manage Applications. Change-Id: I0219195dd0c74d8c003ef1c3f6e09714859d7f89
Diffstat (limited to 'src/com/android/settings/MasterClear.java')
-rw-r--r--src/com/android/settings/MasterClear.java35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 4de0e44..e653d90 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -16,20 +16,16 @@
package com.android.settings;
+import com.android.internal.os.storage.ExternalStorageFormatter;
import com.android.internal.widget.LockPatternUtils;
import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.os.ServiceManager;
-import android.os.SystemProperties;
-import android.text.TextUtils;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
+import android.widget.CheckBox;
/**
* Confirm and execute a reset of the device to a clean "just out of the box"
@@ -48,6 +44,8 @@ public class MasterClear extends Activity {
private View mInitialView;
private Button mInitiateButton;
+ private View mExternalStorageContainer;
+ private CheckBox mExternalStorage;
private View mFinalView;
private Button mFinalButton;
@@ -63,8 +61,14 @@ public class MasterClear extends Activity {
return;
}
- sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
- // Intent handling is asynchronous -- assume it will happen soon.
+ if (mExternalStorage.isChecked()) {
+ Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET);
+ intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
+ startService(intent);
+ } else {
+ sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
+ // Intent handling is asynchronous -- assume it will happen soon.
+ }
}
};
@@ -145,6 +149,16 @@ public class MasterClear extends Activity {
mInitiateButton =
(Button) mInitialView.findViewById(R.id.initiate_master_clear);
mInitiateButton.setOnClickListener(mInitiateListener);
+ mExternalStorageContainer =
+ mInitialView.findViewById(R.id.erase_external_container);
+ mExternalStorage =
+ (CheckBox) mInitialView.findViewById(R.id.erase_external);
+ mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mExternalStorage.toggle();
+ }
+ });
}
setContentView(mInitialView);
@@ -170,7 +184,8 @@ public class MasterClear extends Activity {
public void onPause() {
super.onPause();
- establishInitialState();
+ if (!isFinishing()) {
+ establishInitialState();
+ }
}
-
}