恢复出厂设置全部格式化SD phone Stoarge

    恢复出厂设置全部格式化SD phone Stoarge

diff --git a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java b/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
index c3772be..ef0dc1c 100755
--- a/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
+++ b/core/java/com/android/internal/os/storage/ExternalStorageFormatter.java
@@ -21,6 +21,8 @@ import android.widget.Toast;
 
 import com.android.internal.R;
 
+import java.io.File;
+
 /**
  * Takes care of unmounting and formatting external storage.
  */
@@ -28,6 +30,8 @@ public class ExternalStorageFormatter extends Service
         implements DialogInterface.OnCancelListener {
     static final String TAG = "ExternalStorageFormatter";
 
+       File file = new File("/mnt/sdcard2");
+
     public static final String FORMAT_ONLY = "com.android.internal.os.storage.FORMAT_ONLY";
     public static final String FORMAT_AND_FACTORY_RESET = "com.android.internal.os.storage.FORMAT_AND_FACTORY_RESET";
 
@@ -146,6 +150,9 @@ public class ExternalStorageFormatter extends Service
     }
 
     void updateProgressState() {
+
+               
+
         String status = mStorageVolume == null ?
                 Environment.getExternalStorageState() :
                 mStorageManager.getVolumeState(mStorageVolume.getPath());
@@ -160,7 +167,12 @@ public class ExternalStorageFormatter extends Service
                     mStorageVolume.getPath();
             try {
                 // Remove encryption mapping if this is an unmount for a factory reset.
+                                Log.i("lensun" , "External Stroage Formatter extStoragePath="+extStoragePath + "  mFactoryReset = "+mFactoryReset);
                 mountService.unmountVolume(extStoragePath, true, mFactoryReset);
+                               if (file.exists()) {
+                                mountService.unmountVolume("/mnt/sdcard2", true, mFactoryReset);
+                                 Log.i("lensun" , "External Stroage unmountVolume   /mnt/sdcard2");
+                                }
             } catch (RemoteException e) {
                 Log.w(TAG, "Failed talking with mount service", e);
             }
@@ -181,6 +193,14 @@ public class ExternalStorageFormatter extends Service
                         boolean success = false;
                         try {
                             mountService.formatVolume(extStoragePath);
+                                                               if (file.exists()) {
+                                                                       mountService.formatVolume("/mnt/sdcard2");
+                                                                        Log.i("lensun" , "External Stroage Formatter   /mnt/sdcard2");
+                                                               }
+
+                                                        Log.i("lensun" , "External Stroage Formatter   updateProgressState extStoragePath="+extStoragePath);
                             success = true;
                         } catch (Exception e) {
                             Toast.makeText(ExternalStorageFormatter.this,
lensun3@git-lensun:~/lensun3/bean_rda/intex_629E/frameworks/base$ 

猜你喜欢

转载自blog.csdn.net/ruidongren/article/details/51207514