am cfb9c213: am b7fb6600: am 7021e104: Merge "MtpService: check primary storage status when use it in PTP mode"
* commit 'cfb9c213d7bbcddae215f85343385adb9631a15d':
MtpService: check primary storage status when use it in PTP mode
diff --git a/src/com/android/providers/media/MtpService.java b/src/com/android/providers/media/MtpService.java
index fce8360..545fcde 100644
--- a/src/com/android/providers/media/MtpService.java
+++ b/src/com/android/providers/media/MtpService.java
@@ -50,7 +50,13 @@
private void addStorageDevicesLocked() {
if (mPtpMode) {
// In PTP mode we support only primary storage
- addStorageLocked(mVolumeMap.get(mVolumes[0].getPath()));
+ String path = mVolumes[0].getPath();
+ if (path != null) {
+ String state = mStorageManager.getVolumeState(path);
+ if (Environment.MEDIA_MOUNTED.equals(state)) {
+ addStorageLocked(mVolumeMap.get(mVolumes[0].getPath()));
+ }
+ }
} else {
for (StorageVolume volume : mVolumeMap.values()) {
addStorageLocked(volume);