Ignore packages whose sandboxes are already created.

Bug: 124788246
Test: manual
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
Change-Id: Ie80bbdebc9d3d50e96d2cd17db804b7589b49055
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 3decc0c..91f4597 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -866,6 +866,12 @@
         // be created when the user starts.
         return 0;
     }
+
+    auto& userPackages = mUserPackages[userId];
+    if (std::find(userPackages.begin(), userPackages.end(), packageName) != userPackages.end()) {
+        return 0;
+    }
+
     LOG(VERBOSE) << "prepareSandboxForApp: " << packageName << ", appId=" << appId
                  << ", sandboxId=" << sandboxId << ", userId=" << userId;
     mUserPackages[userId].push_back(packageName);