diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-10-16 16:55:30 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-16 16:55:30 -0700 |
commit | 593a7049f52d46a4e47162e2e3f2c5730e8ccfd8 (patch) | |
tree | 5b0b4ef8301fb58f82104a4749fcc59deb45822f /src/com/android/settings/MasterClear.java | |
parent | ea86bcd12bed863ec6d5109ea84572f355c88609 (diff) | |
parent | 1337d0f70b18dd732c6a617be83e5be0bb8f2f87 (diff) | |
download | packages_apps_settings-593a7049f52d46a4e47162e2e3f2c5730e8ccfd8.zip packages_apps_settings-593a7049f52d46a4e47162e2e3f2c5730e8ccfd8.tar.gz packages_apps_settings-593a7049f52d46a4e47162e2e3f2c5730e8ccfd8.tar.bz2 |
am 1337d0f7: Implement issue #3094621 and #3094609 - wipe sd card
Merge commit '1337d0f70b18dd732c6a617be83e5be0bb8f2f87' into gingerbread-plus-aosp
* commit '1337d0f70b18dd732c6a617be83e5be0bb8f2f87':
Implement issue #3094621 and #3094609 - wipe sd card
Diffstat (limited to 'src/com/android/settings/MasterClear.java')
-rw-r--r-- | src/com/android/settings/MasterClear.java | 35 |
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(); + } } - } |