am 7021e104: Merge "MtpService: check primary storage status when use it in PTP mode"

* commit '7021e10495b533cf75f032542afa8a2fd703f918':
  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);