Add support for more expressive SD card permissions
We now run an sdcard fuse daemon on top of a physical SD card.
Add support for that.
Bug: 10330128
Change-Id: I6a291f861ccb0f2911c07cc8f659e2cec4e6d76c
diff --git a/main.cpp b/main.cpp
index 02506e7..d4b7d28 100644
--- a/main.cpp
+++ b/main.cpp
@@ -174,16 +174,6 @@
DirectVolume *dv = NULL;
flags = 0;
- dv = new DirectVolume(vm, fstab->recs[i].label,
- fstab->recs[i].mount_point,
- fstab->recs[i].partnum);
-
- if (dv->addPath(fstab->recs[i].blk_device)) {
- SLOGE("Failed to add devpath %s to volume %s",
- fstab->recs[i].blk_device, fstab->recs[i].label);
- goto out_fail;
- }
-
/* Set any flags that might be set for this volume */
if (fs_mgr_is_nonremovable(&fstab->recs[i])) {
flags |= VOL_NONREMOVABLE;
@@ -191,7 +181,18 @@
if (fs_mgr_is_encryptable(&fstab->recs[i])) {
flags |= VOL_ENCRYPTABLE;
}
- dv->setFlags(flags);
+ /* Only set this flag if there is not an emulated sd card */
+ if (fs_mgr_is_noemulatedsd(&fstab->recs[i]) &&
+ !strcmp(fstab->recs[i].fs_type, "vfat")) {
+ flags |= VOL_PROVIDES_ASEC;
+ }
+ dv = new DirectVolume(vm, &(fstab->recs[i]), flags);
+
+ if (dv->addPath(fstab->recs[i].blk_device)) {
+ SLOGE("Failed to add devpath %s to volume %s",
+ fstab->recs[i].blk_device, fstab->recs[i].label);
+ goto out_fail;
+ }
vm->addVolume(dv);
}