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
This commit is contained in:
Martijn Coenen 2019-12-03 16:11:39 +01:00
parent 8f1e7f289f
commit 745e0a9acb

View file

@ -23,6 +23,7 @@
#include <list>
#include <mutex>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
@ -84,7 +85,7 @@ class VolumeManager {
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 @@ class VolumeManager {
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;