Also delay creating found disks until user 0 is started.
Public and private volumes can be discovered before user 0 is up and running; when using FUSE however, we can't mount these disks yet, because we depend on the user to become unlocked before we can start the FUSE daemon (which is the MediaProvider application process). So besides waiting for any secure keyguard to be dismissed, also wait for user 0 to be started. Bug: 146419093 Test: Boot cuttlefish with a fake public volume; is available after repeated boots. Change-Id: I06fe4d336d1baec3a49886c3cf12d844a1d0eb26
This commit is contained in:
parent
13ff668775
commit
cf5916f3fa
2 changed files with 20 additions and 5 deletions
|
@ -264,10 +264,17 @@ void VolumeManager::handleBlockEvent(NetlinkEvent* evt) {
|
|||
void VolumeManager::handleDiskAdded(const std::shared_ptr<android::vold::Disk>& disk) {
|
||||
// For security reasons, if secure keyguard is showing, wait
|
||||
// until the user unlocks the device to actually touch it
|
||||
// Additionally, wait until user 0 is actually started, since we need
|
||||
// the user to be up before we can mount a FUSE daemon to handle the disk.
|
||||
bool userZeroStarted = mStartedUsers.find(0) != mStartedUsers.end();
|
||||
if (mSecureKeyguardShowing) {
|
||||
LOG(INFO) << "Found disk at " << disk->getEventPath()
|
||||
<< " but delaying scan due to secure keyguard";
|
||||
mPendingDisks.push_back(disk);
|
||||
} else if (!userZeroStarted) {
|
||||
LOG(INFO) << "Found disk at " << disk->getEventPath()
|
||||
<< " but delaying scan due to user zero not having started";
|
||||
mPendingDisks.push_back(disk);
|
||||
} else {
|
||||
disk->create();
|
||||
mDisks.push_back(disk);
|
||||
|
@ -482,6 +489,8 @@ int VolumeManager::onUserStarted(userid_t userId) {
|
|||
}
|
||||
|
||||
mStartedUsers.insert(userId);
|
||||
|
||||
createPendingDisksIfNeeded();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -496,17 +505,22 @@ int VolumeManager::onUserStopped(userid_t userId) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int VolumeManager::onSecureKeyguardStateChanged(bool isShowing) {
|
||||
mSecureKeyguardShowing = isShowing;
|
||||
if (!mSecureKeyguardShowing) {
|
||||
// Now that secure keyguard has been dismissed, process
|
||||
// any pending disks
|
||||
void VolumeManager::createPendingDisksIfNeeded() {
|
||||
bool userZeroStarted = mStartedUsers.find(0) != mStartedUsers.end();
|
||||
if (!mSecureKeyguardShowing && userZeroStarted) {
|
||||
// Now that secure keyguard has been dismissed and user 0 has
|
||||
// started, process any pending disks
|
||||
for (const auto& disk : mPendingDisks) {
|
||||
disk->create();
|
||||
mDisks.push_back(disk);
|
||||
}
|
||||
mPendingDisks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
int VolumeManager::onSecureKeyguardStateChanged(bool isShowing) {
|
||||
mSecureKeyguardShowing = isShowing;
|
||||
createPendingDisksIfNeeded();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class VolumeManager {
|
|||
int onUserStarted(userid_t userId);
|
||||
int onUserStopped(userid_t userId);
|
||||
|
||||
void createPendingDisksIfNeeded();
|
||||
int onSecureKeyguardStateChanged(bool isShowing);
|
||||
|
||||
int setPrimary(const std::shared_ptr<android::vold::VolumeBase>& vol);
|
||||
|
|
Loading…
Reference in a new issue