Use a regular set for started users.
We want started users to be an ordered set; eg user 0 should always go
first. This is because volumes for users other than 0 depend on user 0
coming up first, because the volume for user 0 is the one mounting
sdcardfs.
Bug: 13789012
Test: atest AdoptableHostTest
Change-Id: Ic9119f0a24bd261e5362019836ac240b90c681c0
diff --git a/VolumeManager.h b/VolumeManager.h
index aff5aaf..fad3c00 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -23,6 +23,7 @@
#include <list>
#include <mutex>
+#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
@@ -84,7 +85,7 @@
void listVolumes(android::vold::VolumeBase::Type type, std::list<std::string>& list) const;
- const std::unordered_set<userid_t>& getStartedUsers() const { return mStartedUsers; }
+ const std::set<userid_t>& getStartedUsers() const { return mStartedUsers; }
int forgetPartition(const std::string& partGuid, const std::string& fsUuid);
@@ -159,7 +160,9 @@
std::list<std::shared_ptr<android::vold::VolumeBase>> mInternalEmulatedVolumes;
std::unordered_map<userid_t, int> mAddedUsers;
- std::unordered_set<userid_t> mStartedUsers;
+ // This needs to be a regular set because we care about the ordering here;
+ // user 0 should always go first, because it is responsible for sdcardfs.
+ std::set<userid_t> mStartedUsers;
std::string mVirtualDiskPath;
std::shared_ptr<android::vold::Disk> mVirtualDisk;