Loading core/java/com/android/internal/app/ExternalMediaFormatActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.storage.StorageVolume; import android.util.Log; /** Loading Loading @@ -95,6 +96,10 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog if (which == POSITIVE_BUTTON) { Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY); intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME); // Transfer the storage volume to the new intent final StorageVolume storageVolume = getIntent().getParcelableExtra( StorageVolume.EXTRA_STORAGE_VOLUME); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, storageVolume); startService(intent); } Loading packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +18 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.HandlerThread; import android.os.UserHandle; import android.os.storage.StorageEventListener; import android.os.storage.StorageManager; import android.os.storage.StorageVolume; import android.provider.Settings; import android.util.Log; Loading Loading @@ -198,6 +199,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading @@ -212,6 +215,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading Loading @@ -246,6 +251,19 @@ public class StorageNotification extends SystemUI { } } /** * Get the corresponding StorageVolume object for a specific path. */ private final StorageVolume getVolumeByPath(StorageVolume[] volumes, String path) { for (StorageVolume volume : volumes) { if (volume.getPath().equals(path)) { return volume; } } Log.w(TAG, "No storage found"); return null; } /** * Update the state of the USB mass storage notification */ Loading Loading
core/java/com/android/internal/app/ExternalMediaFormatActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.storage.StorageVolume; import android.util.Log; /** Loading Loading @@ -95,6 +96,10 @@ public class ExternalMediaFormatActivity extends AlertActivity implements Dialog if (which == POSITIVE_BUTTON) { Intent intent = new Intent(ExternalStorageFormatter.FORMAT_ONLY); intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME); // Transfer the storage volume to the new intent final StorageVolume storageVolume = getIntent().getParcelableExtra( StorageVolume.EXTRA_STORAGE_VOLUME); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, storageVolume); startService(intent); } Loading
packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +18 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.os.HandlerThread; import android.os.UserHandle; import android.os.storage.StorageEventListener; import android.os.storage.StorageManager; import android.os.storage.StorageVolume; import android.provider.Settings; import android.util.Log; Loading Loading @@ -198,6 +199,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading @@ -212,6 +215,8 @@ public class StorageNotification extends SystemUI { */ Intent intent = new Intent(); intent.setClass(mContext, com.android.internal.app.ExternalMediaFormatActivity.class); intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, getVolumeByPath(mStorageManager.getVolumeList(), path)); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0); setMediaStorageNotification( Loading Loading @@ -246,6 +251,19 @@ public class StorageNotification extends SystemUI { } } /** * Get the corresponding StorageVolume object for a specific path. */ private final StorageVolume getVolumeByPath(StorageVolume[] volumes, String path) { for (StorageVolume volume : volumes) { if (volume.getPath().equals(path)) { return volume; } } Log.w(TAG, "No storage found"); return null; } /** * Update the state of the USB mass storage notification */ Loading