auto import from //branches/cupcake/...@130745
diff --git a/src/com/android/settings/SdCardSettings.java b/src/com/android/settings/SdCardSettings.java
index d10166a..b6935a2 100644
--- a/src/com/android/settings/SdCardSettings.java
+++ b/src/com/android/settings/SdCardSettings.java
@@ -60,6 +60,9 @@
         Button unmountButton = (Button)findViewById(R.id.sdcard_unmount);
         unmountButton.setOnClickListener(mUnmountButtonHandler);
 
+        Button formatButton = (Button)findViewById(R.id.sdcard_format);
+        formatButton.setOnClickListener(mFormatButtonHandler);
+
         mTotalSize = (TextView)findViewById(R.id.total);
         mUsedSize = (TextView)findViewById(R.id.used);
         mAvailableSize = (TextView)findViewById(R.id.available);
@@ -69,6 +72,8 @@
         intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
         intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
         intentFilter.addAction(Intent.ACTION_MEDIA_SHARED);
+        intentFilter.addAction(Intent.ACTION_MEDIA_CHECKING);
+        intentFilter.addAction(Intent.ACTION_MEDIA_NOFS);
         intentFilter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL);
         intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
         intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
@@ -198,6 +203,15 @@
         }
     };
 
+    OnClickListener mFormatButtonHandler = new OnClickListener() {
+        public void onClick(View v) {
+            try {
+                mMountService.formatMedia(Environment.getExternalStorageDirectory().toString());
+            } catch (RemoteException ex) {
+            }
+        }
+    };
+
 
     private int         mStatus;
     private IMountService   mMountService;