您的位置:首页 > 其它

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

2016-04-21 11:41 531 查看
    恢复出厂设置全部格式化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$ 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: