FP2-627: The MTP function is invalid at guest mode.

When device is connected to host computer in MTP mode and new
user is added the contents of internal storage and SDCard are
swapped.

The issue is because in new user case the volume paths are set
in reverse order and getting of storage id from framework is
based on the the index and not path for now. This results in
swapped storage_ids for internal and external storage.

Change-Id: I0e456645df3f5294c33e15dd8dcbb66a24d7dad1
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 379dba4..36d11c4 100755
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -3011,7 +3011,13 @@
             if (path.startsWith(test)) {
                 int length = test.length();
                 if (path.length() == length || path.charAt(length) == '/') {
-                    return MtpStorage.getStorageId(i);
+                    // return MtpStorage.getStorageId(i);
+                    // if new paths are added in future or mount points
+                    // are changed, corresponding changes might be necessary
+                    if (test.startsWith("/storage/emulated"))
+                        return MtpStorage.getStorageId(0);
+                    else if (test.startsWith("/storage/sdcard1"))
+                        return MtpStorage.getStorageId(1);
                 }
             }
         }