Loading core/java/com/android/internal/app/ExternalMediaFormatActivity.java +8 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.widget.Toast; /** * This activity is shown to the user to confirm formatting of external media. Loading Loading @@ -95,7 +96,13 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog if (which == POSITIVE_BUTTON) { Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY); intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME); if (getIntent().hasExtra("path")) { String path = getIntent().getStringExtra("path"); intent.putExtra("path", path); startService(intent); } else { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); } } // No matter what, finish the activity Loading core/java/com/android/internal/os/storage/ExternalStorageFormatter.java +16 −4 Original line number Diff line number Diff line Loading @@ -75,11 +75,13 @@ public class ExternalStorageFormatter extends Service @Override public int onStartCommand(Intent intent, int flags, int startId) { // We try to get the path from the intent // If it isn't set, we default to Environment.getExternalStorageDirectory() // We get the path from the intent and if it isn't set // we do not default to Environment.getExternalStoragePath() // because this can be the wrong sdcard in the case where // the device has more than one sdcard (as is becoming more // and more common). We will handle the null later when we // try to actually use the extStoragePath. extStoragePath = intent.getStringExtra("path"); if (extStoragePath == null) extStoragePath = Environment.getExternalStorageDirectory().toString(); if (FORMAT_AND_FACTORY_RESET.equals(intent.getAction())) { mFactoryReset = true; } Loading Loading @@ -123,6 +125,11 @@ public class ExternalStorageFormatter extends Service public void onCancel(DialogInterface dialog) { IMountService mountService = getMountService(); try { if (extStoragePath == null) { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); stopSelf(); return; } mountService.mountVolume(extStoragePath); } catch (RemoteException e) { Log.w(TAG, "Failed talking with mount service", e); Loading @@ -141,6 +148,11 @@ public class ExternalStorageFormatter extends Service void updateProgressState() { String status = Environment.MEDIA_CHECKING; try { if (extStoragePath == null) { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); stopSelf(); return; } status = getMountService().getVolumeState(extStoragePath); } catch (RemoteException e) { Log.w(TAG, "Failed talking with mount service", e); Loading packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +2 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,7 @@ public class StorageNotification extends StorageEventListener { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra("path", path); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading @@ -217,6 +218,7 @@ public class StorageNotification extends StorageEventListener { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra("path", path); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading Loading
core/java/com/android/internal/app/ExternalMediaFormatActivity.java +8 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.widget.Toast; /** * This activity is shown to the user to confirm formatting of external media. Loading Loading @@ -95,7 +96,13 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog if (which == POSITIVE_BUTTON) { Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY); intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME); if (getIntent().hasExtra("path")) { String path = getIntent().getStringExtra("path"); intent.putExtra("path", path); startService(intent); } else { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); } } // No matter what, finish the activity Loading
core/java/com/android/internal/os/storage/ExternalStorageFormatter.java +16 −4 Original line number Diff line number Diff line Loading @@ -75,11 +75,13 @@ public class ExternalStorageFormatter extends Service @Override public int onStartCommand(Intent intent, int flags, int startId) { // We try to get the path from the intent // If it isn't set, we default to Environment.getExternalStorageDirectory() // We get the path from the intent and if it isn't set // we do not default to Environment.getExternalStoragePath() // because this can be the wrong sdcard in the case where // the device has more than one sdcard (as is becoming more // and more common). We will handle the null later when we // try to actually use the extStoragePath. extStoragePath = intent.getStringExtra("path"); if (extStoragePath == null) extStoragePath = Environment.getExternalStorageDirectory().toString(); if (FORMAT_AND_FACTORY_RESET.equals(intent.getAction())) { mFactoryReset = true; } Loading Loading @@ -123,6 +125,11 @@ public class ExternalStorageFormatter extends Service public void onCancel(DialogInterface dialog) { IMountService mountService = getMountService(); try { if (extStoragePath == null) { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); stopSelf(); return; } mountService.mountVolume(extStoragePath); } catch (RemoteException e) { Log.w(TAG, "Failed talking with mount service", e); Loading @@ -141,6 +148,11 @@ public class ExternalStorageFormatter extends Service void updateProgressState() { String status = Environment.MEDIA_CHECKING; try { if (extStoragePath == null) { Toast.makeText(this, "Invalid path: null", Toast.LENGTH_LONG).show(); stopSelf(); return; } status = getMountService().getVolumeState(extStoragePath); } catch (RemoteException e) { Log.w(TAG, "Failed talking with mount service", e); Loading
packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +2 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,7 @@ public class StorageNotification extends StorageEventListener { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra("path", path); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading @@ -217,6 +218,7 @@ public class StorageNotification extends StorageEventListener { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra("path", path); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading